View Full Version : this.getRow(row) is undefined

26 Mar 2010, 8:42 AM
So I've noticed an interesting error on an application I am developing that has to do with an ArrayStore.

I have an Ext.Window which opens and loads data into an ArrayStore after the window show event fires. The closeAction on the window is set to hide. If the user opens the window again then it waits for the show event to fire again before loading the ArrayStore with information but the difference is that the window doesn't have to render again.

I have found that if the user hides the window and then immediately reopens it that there is an error:

TypeError: this.getRow(row) is undefined

According to my stack trace, this error occurs when I try to do the following:
store.insert(0, new Array(record));

The var "store" of course references the ArrayStore. The var "record" references a default record, generated through store.recordType. The store belongs to an EditorGrid.

So my question is, why is this error occurring? Anyone have any ideas?

26 Mar 2010, 8:46 AM
What debugging have you done?

26 Mar 2010, 8:46 AM
Apart from setting closeAction to 'hide', are you calling close() or hide() to dismiss the window? Close will destroy the window and its descendant components; hide does not.

26 Mar 2010, 8:48 AM
It's a case of being a developer. Break on the error, see what "this" is, and who set it (or did not bother) to that. Go back through the call stack.... Just the things you usually do when you debug.

26 Mar 2010, 9:01 AM
I am not calling close at any point on the window so it always just hides the window. Good suggestion though.

As for debugging:

I have tried removing the autoDestroy:true on the ArrayStore in case that was causing the issue, but that has not made any difference.

Also, using firebug and console.info immediately before the line where the error occurs (in my own code, not in the extjs file) it tells me that the store exists and so does the record.

I'm stumped on what else I might do to debug.

26 Mar 2010, 9:06 AM
As for the stack trace, I can tell exactly where the error is occurring. I have a function "addEmptyRow" which I call, which generates a record using store.recordType and populates that record with the default "blank" record data. The error then occurs when I try to add this line to the store.

Is there some way for me to check the status of the store before I do the insert?

26 Mar 2010, 10:40 AM
Well I never quite figured this one out, so I went with the alternative solution I had been considering.

Basically I put a trigger that prevents the user from immediately reopening the window for 500 milliseconds.

I can't get the error to occur now with that delay trigger in place.

Thanks all.