How is it possible, to switch off caching of dataloading for subgrids.
We have a grid with a subgrid. Once a subgrid of a particular row is shown (i.e. the data was loaded), closing and reopening the subgrid does not cause the data (which was changed externally) to be loaded again.
After closing\opening sub grid sub grid’s values doesnt caching. Actually after closing sub grid it’s object isn’t destroyed. When you againg opening sub grid you see the same sub grid which was loaded at the first time. If you want to reload sub grid after each opening you can do that using “onSubRowOpen” event. This event occurs when a sub-row( sub-grid) was opened(closed).
grid.attachEvent(“onSubRowOpen”, function(id,state){
//any custom logic here
});
Parameters:
id - id of row;
state - {bool} open state, true - opened.
What custom logic would I have to add to reload ths sub grid after each opening?
Using this event you can load new xml for the sub grid:
grid.attachEvent(“onSubRowOpen”, function(id,state){
if (state){
var subGrid=grid.cells(id,COLUMN_INDEX).getSubGrid();
subGrid.clearAll();
subGrid.load(“new_xml_for_sub_grid.xml”);
}
});
Thank You, that works fine except for one problem:
if subgrid load is called from within onSubRowOpen event, the grid is not expanded which causes the subgrid to overlap with follwing rows in the grid (see attachment)
subgrid load from within onsubrowopen problem.doc (39 KB)
Try to change “onSubRowOpen” event handler like following:
mygrid.attachEvent(“onSubRowOpen”, function(id,state){
if (state){
var subGrid=mygrid.cells(id,0).getSubGrid();
subGrid.clearAll();
subGrid.load(“sub1.xml”,function(){
subGrid.callEvent(“onGridReconstructed”,[]);
});
}
});
Thank You, that works perfect!