PDA

View Full Version : RowEditor "f is undefined"



Brett889
8 Jun 2010, 8:33 PM
Working off the desktop example, I have a window with a grid using the RowEditor plugin. I open this window and the row editor works fine; however, when I close the window and open it for a second time, the row editor produces an error when I try to add or edit a row - "f is undefined" on line 168 of RowEditor.js.

I do not get this error if I just open the window, close the window, open again, and then use the row editor; nor do I get the error if I use it multiple times on the first opening of the window. It is only if I use it; close the window; open again; and then try to use it again.



//From the method "startEditing" in RowEditor.js
var cm = g.getColumnModel(), fields = this.items.items, f, val;
for(var i = 0, len = cm.getColumnCount(); i < len; i++){
val = this.preEditValue(record, cm.getDataIndex(i));
f = fields[i];
f.setValue(val);//line 168
this.values[f.id] = Ext.isEmpty(val) ? '' : val;
}


When I break in here on the first time I open the window, I can see that this.items.items is an array containing an object for each column in my grid; but on the second time I open the window, it does not contain anything (resulting in f containing nothing).

Thanks for reading, and I greatly appreciate any help anyone can give me, as I've been stuck on this for many hours now.

Thanks,
Brett

evant
8 Jun 2010, 9:19 PM
Have a look at the closeAction property on window.

Brett889
8 Jun 2010, 10:10 PM
Thanks for the reply. When I set closeAction to "hide", it just minimizes my window to the taskbar when I go to close it. This would fix the issue, but I would have to figure out how to not display it on the taskbar. Any suggestions?

Thanks again.

evant
8 Jun 2010, 10:17 PM
Well, the important part is, when you call close, it destroys everything underneath it.

I'm betting you're doing something like this:



var rowed = new Foo...();
if(!win){
new Ext.Window({
.... plugins: [rowed]
});
}

Brett889
9 Jun 2010, 2:29 PM
Thank you! The issue was that I was declaring RowEditor globally, instead of inside the window object. Thanks for your help.