how to pass params from a paging toolbar?
new SPD.SearchPagingToolbar({
id: 'pagingtbar',
pageSize: 100,
store: this.store,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: "No topics to display",
//baseParams: {SearchType: sType}
//paramNames:{UserSearchName:'PAGINATION',start:25, limit:25}
});
i need to pass a param as paramname: paramvalue
how can i send a param from the toolbar?
//code for the grid.
this.bbar = new SPD.SearchPagingToolbar({
id: 'pagingtbar',
pageSize: 100,
store: this.store,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: "No topics to display"
//paramNames:{UserSearchName:'PAGINATION',start:25, limit:25}
});
this.store.on('beforeload',this.beforeLoad,this);
beforeLoad: function(store, options){
Ext.applyIf(options.params, {
searchType: "searchRatingsGrid"
});
}
Code for the paging toolbar:
The onclick event passes an extra variable search type.
doLoad : function(start, searchType){
console.log('search type ' + searchType); -> This returns 'undefined'.
var o = {}, pn = this.paramNames;
o[pn.start] = start;
o[pn.limit] = this.pageSize;
this.store.load({params:o});
},
onClick : function(which, searchType){
var store = this.store;
switch(which){
case "first":
this.doLoad(0, searchType);
break;
case "prev":
this.doLoad(Math.max(0, this.cursor-this.pageSize), searchType);
break;
case "next":
this.doLoad(this.cursor+this.pageSize, searchType);
break;
case "last":
var total = store.getTotalCount();
var extra = total % this.pageSize;
var lastStart = extra ? (total - extra) : total-this.pageSize;
this.doLoad(lastStart, searchType);
break;
case "refresh":
this.doLoad(this.cursor, searchType);
break;
}
}
is there a need for me to pass the searchtype as a variable to the delegate function of the onClick event?
this.next = this.addButton({
tooltip: this.nextText,
iconCls: "x-tbar-page-next",
disabled: true,
handler: this.onClick.createDelegate(this, ["next"])
});
Please let me know if this is the right approach.
#If you have any other info about this subject , Please add it free.# |