PDA

View Full Version : [3.0] this.grid is undefined



FkrZiM
21 Aug 2009, 10:12 AM
Hello
I need help.
My grid pattern to other screens (the father) is the problem "random". Sometimes it happens, sometimes not (almost always).
Seems to be happening in Ext.data.Store the following line:



listeners: {
'load': function (ste) {
Ext.getCmp('grid-' + windowId).getSelectionModel().selectFirstRow();
}
}
in this line: ->> Ext.getCmp('grid-' + windowId).getSelectionModel().selectFirstRow();

All help is welcome.
Thank you.

tryanDLS
21 Aug 2009, 2:34 PM
http://extjs.com/learn/Ext_Forum_Help

FkrZiM
24 Aug 2009, 5:55 AM
Someone to help?
I need that when open the window, automatically select the first row of the grid.
Sorry for my English. I'm Brazilian.
Thanks

Animal
24 Aug 2009, 5:59 AM
It's because of deferred rendering. Defer the call for a few milliseconds.

FkrZiM
24 Aug 2009, 9:36 AM
what's the command?
I tried with delay and failed.
Actually are two tabs, and when I select something in the first tab, the second tab loads the database dependence of the first tab.
Following is the most complete command:



this.store = new Ext.data.Store({
proxy: ........ (not necessary)
}),
reader: ......... (not necessary)
},
fieldsStore),
listeners: {
'load': function (ste) {
Ext.getCmp('grid-' + windowId).getSelectionModel().selectFirstRow();
}
}
});

gridRegister.superclass.constructor.call(this, {
id: 'grid-' + windowId,
height: 320,
title: 'Information',
border: true,
loadMask: {
msg: 'Loading...'
},
listeners: {
render: function (g) {
g.getSelectionModel().selectRow(0);
},
delay: 10
},
sm: new Ext.grid.RowSelectionModel({
singleSelect: true,
listeners: {
rowselect: function (sm, row, rec) {
Ext.getCmp('form-' + windowId).getForm().loadRecord(rec);
}
}
})
});

Animal
24 Aug 2009, 9:39 AM
delay 10 won't be enough because IIRC, after rendering the Grid, the View's final update is only deferred by 10ms, so your listener will be executed too soon.

I know its a bit crap having to delay arbitrary times, but the next release has a viewready event which will be the right one to hook into to select the first row.

FkrZiM
24 Aug 2009, 9:59 AM
Ok.
Thank's for your help, but yet not solved my problem.

Sorry, but I'm beginner in ExtJS.

Animal
24 Aug 2009, 10:01 AM
OK, back to a problem. What problem, where?

FkrZiM
24 Aug 2009, 10:16 AM
The problem is that sometimes not only selects the grid, causing errors. But even so, pass the information on the grid for the form and the second tab (depends on the first tab).
Only sometimes.

My English is very bad, sorry.

Animal
24 Aug 2009, 1:38 PM
No. I'm lost now.

FkrZiM
25 Aug 2009, 6:29 AM
With the delay worked in IE, not in FF.
In FF did not back the first record selected on the grid.
I tried one if grid isVisible and not work in FF too.
I think to getting there, at least in IE is now fixed.
Any suggestions?
Thank you guy.

FkrZiM
26 Aug 2009, 7:07 AM
Got it!
Thank´s guys!