PDA

View Full Version : [Solved] Store and baseParams weirdness



cocorossello
13 Jun 2007, 8:05 AM
Hi,

I have some strange problems with the store reload and setting the baseParams.

I set some filters on the beforeLoad event (example)

ds.on('beforeLoad', function(){
//clear baseParams
ds.baseParams={};
if (filter)
ds.baseParams['filter1']= 'someValue';
});

The problem comes when i call a ds.reload() with filter==false .
I'm still getting filter1 with 'someValue' !!!

Also, if i click the wheel thing to refresh in the foot of the grid i don't get filter1.
(both times the beforeLoad event takes place)

Any ideas?

cocorossello
13 Jun 2007, 8:09 AM
i have also tried with

ds.baseParams=undefined;
delete(ds.baseParams);
....

jsakalos
13 Jun 2007, 8:10 AM
Is variable filter visible from the event handler?

PS: Please post code in php tags, it's much easier to read it then.

jsakalos
13 Jun 2007, 8:11 AM
And one thing more: There is no beforeLoad event; there is beforeload event. Case matters.

cocorossello
13 Jun 2007, 8:15 AM
Thx for the reply.

Yes, it is visible.

According to documentation, reload method says:

'Reloads the Record cache from the configured Proxy using the configured Reader and the options from the last load operation performed. '

I dont know if the options include the baseParams, but anyway the beforeLoad event takes place before the load is actually done (as usual)

cocorossello
13 Jun 2007, 8:16 AM
I misspelled it in the example. Of course it's 'beforeload' in the code.

cocorossello
13 Jun 2007, 8:22 AM
Ok, i got it to work, I only have to set all the filter's values all the times, even if its null ( '' ).

Its weird....