Opened 12 years ago

Closed 11 years ago

#6725 closed enhancement (invalid)

Grid model enhancement: add data loaded event

Reported by: John Locke Owned by: sorvell
Priority: high Milestone:
Component: DojoX Grid Version: 1.1.0
Keywords: Cc: john@…
Blocked By: Blocking:

Description

Currently there is no straightforward way to know when a model has finished loading data. In my application, I want to set the height of the visible grid based on the number of rows loaded in the model, but do not know when the model is finished loading to be able to resize the grid.

Implementing this for dojox.grid._data.DojoData? is trivial: at the end of processRows, add a single line:

svn diff dojo/

Index: dojo/dojox/grid/_data/model.js
===================================================================
--- dojo/dojox/grid/_data/model.js	(revision 13680)
+++ dojo/dojox/grid/_data/model.js	(working copy)
@@ -509,6 +509,7 @@
 			this._setRowId(item, request.start, idx);
 			this.setRow(row, request.start+idx);
 		}, this);
+		this.notify('DataLoaded');
 		// FIXME: 
 		//	Q: scott, steve, how the hell do we actually get this to update
 		//		the visible UI for these rows?


This hooks into the existing model observer functions, publishing a new event at the end of processing rows returned from the Dojo Data store. To subscribe to this event, just create a modelDataLoaded function on your observer object.

The main issue here is that the model publishes an event for every row changed, but not at the end of loading data. Compared to the data store, this means we've got an onItem, but not an onComplete...

Change History (1)

comment:1 Changed 11 years ago by Bryan Forbes

Resolution: invalid
Status: newclosed

Grid models no longer exist. This issue is invalid since dojo.data has onComplete.

Note: See TracTickets for help on using tickets.