Delayed Listener Bug - Ext JS

My Code:

ds.on('load', foo, this, {delay: 250});

Bug:

h has no properties
(ext-all.js : line 18) - Ext.util.Observable
  # 2  
02-21-2007, 01:30 PM

Are you sure foo exists? That message means your handler function is undefined.

I just tested it locally and it worked as expected. When I passed in an undefined handler function, I got the same message as you.
  # 3  
02-21-2007, 02:02 PM

ok i get it..

I tried doing this and didnt work:
ds.on('load', plantGrid.getView().autoSizeColumns(), this, {delay: 250});

the reason why i was trying to do it this way was because when you put autoSizeColumns in the the configuration of the grid.. it loads to fast and doesn't size properly.

it works now without the delay by doing this:

ds.on('load', adjustGrid, this, {delay: 250});

function adjustGrid(){
plantGrid.getView().autoSizeColumns();
}
  # 4  
02-21-2007, 02:09 PM

The problem is you are executing the function immediately (you have "()" at the end) rather than passing a callback. Also, your scope with be wrong. Here's your original code edited:

var view = plantGrid.getView();
ds.on('load', view.autoSizeColumns, view, {delay: 250});

Here we are passing a function (rather than calling the function) and we are setting the scope to the "view" object so that within autoSizeColumn the this reference with be correct.
  # 5  
02-21-2007, 02:15 PM

NICE!!!..

I never looked at it way. It works perfectly.

THANKS!!

Will be tipping you soon.

你可能感兴趣的:(ext)