To start, what are you using to debug your javascript? Regardless of what it is, I would suggest using firebug for firefox.Anyway, I see two problems with the section with the line you comment as //map vanishes... First, you are registering a function to execute on featureLayer's onLoad event, but featureLayer is not defined, should that be states? What is the purpose of that event? Second, in the query definition for that connection, the qrystates is not defined.Anyway, I have attached a piece of code below from a website of mine, sorry I can't give you a live version. It defines a data table and the events for it, the populates that table as well//This function creates the Data table at the bottom of the page storing all the projects
function createDataTable(){
var data = { identifier: 'id', items: [] };
//Create the store object to populate the table
var rows=nProj;
for (var i=0; i < rows; i++){ data.items.push(dojo.mixin({ id:i+1 }, projectTable)); }
var store = new dojo.data.ItemFileWriteStore({data:data});
//Define layout
var layout = [[
{'name':'Project ID','field':'projID', 'width':'100px'},
{'name':'Title','field':'Title', 'width':'500px'},
{'name':'Provider','field':'Provider', 'width':'100px'},
{'name':'Seeker','field':'Seeker', 'width':'100px'},
{'name':'Topic','field':'Topic', 'width':'200px'},
{'name':'Sub Topic','field':'SubTopic', 'width':'300px'},
]];
var grid = new dojox.grid.DataGrid({
id:'grid',
store:store,
structure:layout,
rowSelector:'20px'},
document.createElement('div')
);
dojo.byId("projectInformation").appendChild(grid.domNode);
grid.startup();
//Event handlers below are used to visualize projects. A single click maps a single connection, a double click maps and entire project
dojo.connect(grid, "onRowClick", grid, function(evt){
var idx = evt.rowIndex,
item = this.getItem(idx);
var defn = "Provider='" + item.Provider + "' AND Seeker='" + item.Seeker + "' AND ProjectID='" + item.projID + "'";
mapLines(defn);
});
dojo.connect(grid, "onRowDblClick", grid, function(evt){
var idx = evt.rowIndex,
item = this.getItem(idx);
var defn = "ProjectID='" + item.projID + "'";
mapLines(defn);
});
}