PDA

View Full Version : Functionality to cfgrid



Pankaj Kumar M
14 Dec 2014, 9:51 PM
Hi,

This is the javascript code snippet

var bbar = Ext.DomHelper.overwrite(grid.bbar,{tag:'div',id:Ext.id()},true);
//Create new PaginToolbar and render it to bbar (grid footer)
gbbar = new Ext.PagingToolbar({renderTo:bbar,
store: grid.store,
pageSize: 10,
displayInfo: true,
displayMsg: '<b>Showing {0} - {1} out of {2} Transactions</b>',
emptyMsg: "<b>No Record</b>",
items:[
'-', {
pressed: false,
enableToggle:false,
tooltip:'Click here to View All Transaction Details',
text: 'View All',// The text that will show for the button in the bar
icon:'css/add.png',//Icon graphic
cls: 'x-btn-text-icon',//The ext class that will display the button with text/icon properly
handler: showWin// handler: showWin // should be replaced with your own function
}

]
});
}

This is snapshot of the page is given below

51279




Here , the 10th row is the total row so there r only 9 records. The displayMessage in the toolbar bar shows ”Showing 1-10 out of 35 transactions”. But the actual message required is “Showing 1-9 out of 35 transactions”. Hope you understood my query.


Thanks & Regards,

Pankaj Kumar M

aaugen
15 Dec 2014, 1:10 AM
Hi Pankaj Kumar M,

How did you proceed to add the 10th totals row? Did you use the feature ext js Summary (http://docs.sencha.com/extjs/4.2.3/#!/api/Ext.grid.feature.Summary) or did you do that manually?
Check the value of your store property "totalCount" associated with the grid:
store.getTotalCount()
It should normally be 9 if you have 9 records.

Pankaj Kumar M
15 Dec 2014, 10:22 PM
Hi Aaugen,

I have added a row in the result query while displaying the records. I have used store.getTotalCount(), but i'm getting the value as 10.

Thanks,

Pankaj Kumar M

aaugen
16 Dec 2014, 12:47 AM
Try to use the feature ext js Summary (http://docs.sencha.com/extjs/4.2.3/#%21/api/Ext.grid.feature.Summary) to show the 10th row instead to add row in the result query.
You are example in API Ext JS:


Ext.create('Ext.grid.Panel', {
title: 'Summary Test',
style: 'padding: 20px',
renderTo: document.body,
features: [{
ftype: 'summary'
}],
columns: [{
dataIndex: 'student',
text: 'Name',
summaryType: 'count',
summaryRenderer: function(value, summaryData, dataIndex) {
return Ext.String.format('{0} student{1}', value, value !== 1 ? 's' : '');
}
}, {
dataIndex: 'mark',
text: 'Mark',
summaryType: 'average'
}]
});

Pankaj Kumar M
18 Dec 2014, 1:58 AM
Hi aaugen,

This isn't working as i'm getting the data from database.

Thanks

Pankaj Kumar M