'm trying to write a javascript framework.
I'm playing with dojox grid, and I'm wonderinh how to dynamically set
the model of a grid.
I'm getting data from server by a xhrPost.
This is the method I added to grid prototype :
dojox.grid.Grid.prototype.fillData = function(objData,params){
params = params || {};
var store = new
dojo.data.ItemFileReadStore({data:objData});
store.fetch();
this.setModel(store);
}
And here is my object declaration (html) :
<table dojoType="dojox.grid.Grid" clientSort="true"
query="{}" jsId="myGrid" >
<THEAD>
<TR>
<TH width="80" sortable="true"> </TH>
<TH field="libelle" width="*" >Menu</TH>
<TH field="parent_name" width="*">Parent</TH>
<TH>Default / First page</TH>
<TH>Valid</TH>
<TH class="button" width="80">Level</TH>
<TH align="center" width="50"> </TH>
</TR>
</THEAD>
</table>
I'm working with dojo 1.1.1 (13707).
I dynamically update my grid using :
myGrid.fillData(data);
data beeing an object containting items.
"modulemenu.grid.model" give "Object _arrayOfAllItems=[9]
_arrayOfTopLevelItems=[9]" but my grid doesn't show anyhting.
I tried myGrid.model.refresh, but this doesn't work.
Any idea to refresh the grid with the new model / store ?
Thanks!
--
David Wartel
--
David Wartel
_______________________________________________
FAQ:
http://dojotoolkit.org/support/faqBook:
http://dojotoolkit.org/docs/bookForums:
http://dojotoolkit.org/forumDojo-interest@...
http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest