I've implemented the dgrid. It's really neat. However when I click on the row header to sort, all but one row disappears. I'm going nuts trying to figure out why....
Let's give this a go.
DGrid, it's a dojo based data grid, see http://dojofoundation.org/packages/dgrid/
When using this with Javascript and HTML and connecting to an Observable MemStore, the grid populates, with several rows quite happily displaying data. The columns are sortable, that is you can click on the the row/column heading. However - and here's the problem - when clicking on these row/column headers to sort the row's, all but one row disappears.
Using a Memory (dojo/store/Memory) a the dGrids data store work fine - ie the rows sort successfully. However when using the Observable (dojo/store/Observable) as a data store the sort causes the rows to collapse. Please see below examples.
Sort working great with Memory:
function populateGrid(Memory, message) {
var featureOne = {
"id": message[0].attributes["id"],
"Col2": message[0].attributes["Col2"],
"Col3": message[0].attributes["Col3"]
}
var featureTwo = {
"id": message[1].attributes["id"],
"Col2": message[1].attributes["Col2"],
"Col3": message[1].attributes["Col3"]
}
var data = [feature1, feature2];
var memStore = new Memory({ data: data });
window.queryRecordsGrid.set("store", memStore);
}
The error occurs when using Observable:
var memStore;
function populateGrid(Memory, message) {
var feature = {
"id": message[0].attributes["id"],
"Col2": message[0].attributes["Col2"],
"Col3": message[0].attributes["Col3"]
}
var data = [feature];
if (!window.memStore) {
window.memStore = new Observable(new Memory({ data: data }));
window.grid.set("store", window.memStore);
} else {
window.grid.store.notify(feature, feature.id);
}
}