-
22 Sep 2007 12:55 AM #1
Selecting a Cell in an Editor Grid once grid is ready
Selecting a Cell in an Editor Grid once grid is ready
I'm trying to pre-select a particular cell in a grid once that grid has finished loading. The actual selection is easy - grid.getSelectionModel.select(rowIndex, colIndex). If I do that once my app is running - say on clicking a toolbar button - it works perfectly.
But then I tried doing it in the load handler for the grid's store, it appears to work, and I can even test that it's worked by calling sm.hasSelection(). But the cell is not selected (or, and thinking about it this is probably relevant - it's not *visibly* selected)
What also works is defering the execution of the call to sm.select(r,c) until a few milliseconds after the store has loaded, ie
Problem with that is I'm 99% sure that the required delay will increase as my data set gets larger.Code:grid.getDataSource().on('load',function(){grid.getSelectionModel.select(r,c);},this,{defer:200});
So, what I'm looking for is an event I can subscribe to which fires only when a grid is 100% ready to respond to a grid.sm.select() call. Store load definitely isn't it, and the grid's 'render' event doesn't seem to be either. Any suggestions? Meanwhile I'm going to look into the possibility that the cell *is* being selected, just not indicated as such visually.
TIA
Matt
PS: this is an Air application, which might be the problem, although I don't think so. This also means that I can't Firebug it of course.Last edited by bitdifferent; 22 Sep 2007 at 1:01 AM. Reason: added PS
-
22 Sep 2007 1:21 AM #2
Well that's interesting... I just increased my test data set size to well above expected real-world usage and the 200 ms parameter still works. Nevertheless, it *feels* wrong!
-
22 Sep 2007 10:01 AM #3
You might try do the select in a handler for the gridview refresh event, which happens after the load. The gridview class isn't fully documented, so you'll have to take a look at the source.
Tim Ryan
Read BEFORE posting a question / BEFORE posting a Bug
Use Google to Search - API / Forum
API Doc (4.x | 3.x | 2.x | 1.x) / FAQ / 1.x->2.x Migration Guide / 2.x->3.x Migration Guide
-
22 Sep 2007 11:29 AM #4
Thanks Tim, I think that's what I'm looking for.
-
23 Sep 2007 12:11 PM #5
Problem in rendering editor for a cell
Problem in rendering editor for a cell
Frndz,
I want to render the editor for a cell on load . Basically in my grid I have a column with 'TextBox' editor. I need to get it disabled and made non-editable for certain rows.
I am new to EXT. Please help !!
My code:
ds.on('load',function(){
cm=grid.getColumnModel();
cm.setRenderer( 8, function(value, p, row, rowIndex, colIndex, ds, editor){
if(ds.data.items[rowIndex].data.exportedFlag=="Y"){
bc = "<input value='"+ds.data.items[rowIndex].data.qty+"' class='my-text' type='textbox' disabled</div>";
}else{
bc = "<div>"+ds.data.items[rowIndex].data.qty+"</div>";
}
});
grid.reconfigure(ds,cm);
});
Here 'disabled' doesn't wrk in IE. So I am trying to find an alternative way.
Thanks
EXTPb


Reply With Quote