View Full Version : event on loading data

1 Feb 2010, 2:25 AM
Hello, I have a grid with checkbox selection model. on 'load' event of the data store of my
gird, I am checking a boolean property of each record, if it has a true value, I am selecting
the record,..... so the problem is that after selecting the records (that should be selected),
all the selections are cleared !!!. my code is the following:

ds.on('load', function(store, recSet,options) {
var i = 0;
var records = new Array();
store.each(function(r) {
var bindValue = r.get('bind');
var pdsnIDValue = r.get('pdsnID');
if(bindValue == true && pdsnIDValue == this.pdsnIden) {
records[i] =r;

i += 1;
}, this);
this.getSelectionModel().selectRecords(records, true);
}, this);

what is surprising is that my code works fine on opera and google Chrome but neither on IE nor on Mozilla
please heeeeeelp me:((

1 Feb 2010, 2:40 AM
Try using the delay option.

1 Feb 2010, 3:26 AM
sorry but i didn't get ur point, you told me to use the delay option, ?

1 Feb 2010, 3:42 AM
Yes. You've found the "on" method in the manual. That tells you that's a shorthand form of the actual method name, and for your convenience links to the actual method where all the options are fully documented.

Mike Robinson
1 Feb 2010, 8:00 AM
What Animal is saying to you is that you should use the "delay" option in the event-handler to cause the event handler to fire a few milliseconds after the event is presented. It can be a miraculous cure for many "inexplicable things."

Not all browser implementations are the same. They use threads and queues and many other things which can cause the actual sequence of computer activities to vary slightly. You might get your notification (literally...) "1/1000 of a second too soon." Or maybe, "it works sometimes but it doesn't work sometimes," blah de blah de blah. A very slight delay gives these things (whatever they might be...) "time to clear through." And the end-user doesn't notice.

Having said that: I don't know if this admonition will turn out to be relevant in this case. Only one way to find out . . .

4 Feb 2010, 6:43 AM
Thanks Mike...

i have used the checkcolumn plugin found in the examples as an alternative to my work
but i will try the 'delay' option .