PDA

View Full Version : Override Paging Tool bar to display number with US format



Nagendrareddy
6 May 2014, 10:23 AM
Hi

Can anyone help me with the problem??? Am migrating my old application from 3.4 to 4.2

I want to display number in US format in paging.. In 3.4 i used below code


Ext.override(Ext.PagingToolbar, {


onLoad : function(store, r, o){
if(!this.rendered){
this.dsLoaded = [store, r, o];
return;
}
var p = this.getParams();
this.cursor = (o.params && o.params[p.start]) ? o.params[p.start] : 0;
var d = this.getPageData(), ap = d.activePage, ps = d.pages;


this.afterTextItem.setText(String.format(this.afterPageText, Ext.util.Format.number(d.pages,'0,000')));
this.inputItem.setValue(ap);
this.first.setDisabled(ap == 1);
this.prev.setDisabled(ap == 1);
this.next.setDisabled(ap == ps);
this.last.setDisabled(ap == ps);
this.refresh.enable();
this.updateInfo();
this.fireEvent('change', this, d);
},


updateInfo: function () {
if (this.displayItem) {
var count = this.store.getCount();
var msg = count == 0 ?
this.emptyMsg :
String.format(
this.displayMsg,
Ext.util.Format.number(this.cursor + 1, '0,000'), Ext.util.Format.number(this.cursor + count, '0,000'), Ext.util.Format.number(this.store.getTotalCount(),'0,000')
);
this.displayItem.setText(msg);
}
}
});


This is not working now for 4.2. Please provide any suggestions

Gary Schlosberg
9 May 2014, 12:40 PM
Not sure why the code isn't working, but can't you just set the displayMsg config to what you need?
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.toolbar.Paging-cfg-displayMsg