PDA

View Full Version : Can i overide displayMsg from pagingtoolbar ? If yes , how ?



shakerkk
19 Sep 2014, 1:49 AM
I want to use displayMsg to show more information about my table so , i want to add more things like :
'Displaying {0} - {1} of {2} - {3} '
For 3 i want add my own function something like :

getSelectedItems: function () { var me = this;
var selItems = me.dyn.view.getSelectionModel().getSelection();
var selItemsLength = selItems.length;
var selItemsIds = [];
var i = 0;
if (selItemsLength) {
for (i = 0; i < selItemsLength; i++) {
selItemsIds.push(selItems[i].internalId);
}
}
return selItemsIds;
}
and return selItemsIds.length + some messege :)

slemmon
1 Oct 2014, 11:08 PM
Hi,

I'm sure what you're wanting to do is doable. Though how to refactor and customize a framework widget can be a heavy topic. Feel free to post your progress here either inline or using https://fiddle.sencha.com and you'll have a better chance of the community chiming in to assist with your user extension.

Farish
2 Oct 2014, 12:43 AM
how about something like this?



var store = Ext.create('Ext.data.Store', {
fields:['name', 'email', 'phone'],
data:
[
{ 'name': 'Lisa', "email":"[email protected]psons.com", "phone":"555-111-1224" },
{ 'name': 'Bart', "email":"[email protected]", "phone":"555-222-1234" },
{ 'name': 'Homer', "email":"[email protected]", "phone":"555-222-1244" },
{ 'name': 'Marge', "email":"[email protected]", "phone":"555-222-1254" }
]
});
Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: store,
columns: [
{ text: 'Name', dataIndex: 'name' },
{ text: 'Email', dataIndex: 'email', flex: 1 },
{ text: 'Phone', dataIndex: 'phone' }
],
height: 200,
width: 400,
renderTo: Ext.getBody(),
bbar: Ext.create('Ext.PagingToolbar', {
store: store,
displayInfo: true,
displayMsg: ' {0} - {1} of {2} - ' + myfunc(),
})
});

// this would be your function where you can do any calculations you want and return the value
function myfunc()
{
return "mycount";
}

you can do an override as done in the locale files. e.g.


Ext.define("Ext.mytoolbar.Paging", {
override: "Ext.PagingToolbar",
displayMsg: ' {0} - {1} of {2} - ' + myfunc()
});

watertrac_dev
3 Oct 2014, 10:39 AM
How about this?

ba9

anant.choubey
20 Feb 2015, 6:46 AM
Thank You.

This was very useful.