I am not 100% sure this will solve your issues but I have found some problems with the esri dgrid example when using more than 50 or 60 features. Hopefully this will help someone out there. I am developing a crime app using the dgrid and a featurelayer. When the user clicks on a crime point in the map it is supposed to highlight the corresponding record in the dgrid. Sometimes it would work other time it wouldn't. Using Firebug I noticed that not all of my crime records were showing up in the dgrid. The data was in the dgrid store they just were not being shown. After some searching I realized it was probably being caused by the bug listed in item #1. 1. There is know bug with the dgrid widget that has caused me serious pain while developing my app. It sounds like it is effecting you guys as well. https://github.com/SitePen/dgrid/issues/318After banging my head against the wall for 3 straight days I finally figured out a work around. Rather than using a store I simply rendered the data array. function onSelectionResults(fs) {
var data = dojo.map(fs, function (feature) {
return {
// property names used here match those used when creating the dgrid
'id': feature.attributes[window.outFields[2]],
"INC_REPORT": feature.attributes[window.outFields[0]],
"AGENCY_CODE": feature.attributes[window.outFields[3]],
"DESCRIPTION": feature.attributes[window.outFields[4]],
"START_DATE": feature.attributes[window.outFields[5]],
"ADDRESS": feature.attributes[window.outFields[6]]
}
});
/*--------these two lines went away-----------*/
//var mStore = new dojo.store.Memory({data:data})
// window.grid.set("store", mStore);
/*-----------------------------------------------*/
/*------THIS IS WHAT I USE NOW---------/
window.grid.renderArray(data)
/*---------------------------------------*/
Then I had to figure out how to select a row from a grid without a store.
// fires when a feature on the map is clicked
function selectGrid(e) {
var id = e.graphic.attributes.OBJECTID;
/*rowNode holds all the dom Nodes that reference the objectid of the clicked crime point*/
/*the dojo.query returned a 9 object array. Using firebug I found the array index that corresponded to the row node*/
var rowNode = dojo.query("*", dojo.byId('div')).filter(function (node) { if
(node.textContent.indexOf(id) !== -1) { return node; } });
//index[6] is where the row is returned from the query
var rowIdx = window.grid.row(rowNode[6].rowIndex);
if (rowIdx.data != undefined)
{
window.grid.clearSelection();
window.grid.select(rowIdx);
grid.bodyNode.scrollTop = rowIdx.element.offsetTop;
}
else
{
var pte = pointToExtent(map, e.mapPoint, 15)
// console.log('the featurelayer click extent xmax', pte.xmax)
// console.log('the featurelayer click extent ymax', pte.ymax)
findPointsInExtent(pte, e)
}
}
I have tested the code with 500 records and so far its stable.