PDA

View Full Version : pagingToolbar suggestion


mjlecomte
12-25-2008, 12:11 PM
Minor suggestion.

Currently code has:

doLoad : function(start){
var o = {}, pn = this.paramNames;
o[pn.start] = start;
o[pn.limit] = this.pageSize;
if(this.fireEvent('beforechange', this, o) !== false){
this.store.load({params:o});
}
},

Not much point in doing anything if beforechange returns false is there?

doLoad : function(start){
if(this.fireEvent('beforechange', this, o) !== false){
var o = {}, pn = this.paramNames;
o[pn.start] = start;
o[pn.limit] = this.pageSize;
this.store.load({params:o});
}
},

jgarcia@tdg-i.com
12-27-2008, 01:29 PM
Minor suggestion.

Currently code has:

doLoad : function(start){
var o = {}, pn = this.paramNames;
o[pn.start] = start;
o[pn.limit] = this.pageSize;
if(this.fireEvent('beforechange', this, o) !== false){
this.store.load({params:o});
}
},

Not much point in doing anything if beforechange returns false is there?

doLoad : function(start){
if(this.fireEvent('beforechange', this, o) !== false){
var o = {}, pn = this.paramNames;
o[pn.start] = start;
o[pn.limit] = this.pageSize;
this.store.load({params:o});
}
},


Eh: :)

o is not defined in your version - when the event fires


:)

mjlecomte
12-27-2008, 09:38 PM
Hmph. Too true. :">

Ok, to prevent another blunder for the day.... Is it me or does neither the change nor beforechange events even show up in the docs?

And, while your statement is true, I'm having a hard time imagining how someone would inspect the paramNames and use that to determine if they should return true/false to prevent the page from loading (especially when they could catch it at the beforeload event of the store just as well). I'm all for injection points, just don't see the usage case here (and neither do many others if it undocumented :) ).

jgarcia@tdg-i.com
12-28-2008, 08:51 AM
The docs need to be updated. (Nige?) .

I've never used the paging toolbar's events, as I subscribe to the datastore's events as well. :-]

mystix
01-04-2009, 09:17 PM
updated in SVN.

do help to review the verbiage -- i added the descriptions before gulping down my morning coffee. ;)

mjlecomte
01-05-2009, 02:57 AM
Looks good to me, only comment (without coffee):

The total number of pages which will be returned from the server, based on the current {@link #pageSize}

We don't know if they "will" or not, maybe:

The calculated number of pages based on the current {@link #pageSize} and total number of records.

~o)

mystix
01-05-2009, 03:49 AM
good point. changed it to this:

The total number of pages (calculated from the total number of records in the dataset as returned by the server and the current pageSize)