I'm using jqGrid with the jqPivot.
My problem is totalText of jqPivot. In document: totalText: "{0} {1}"
The totalText option contains the template with {0} and {1} which will be replaced to aggregates[i].aggregator and aggregates[i].member
Can I replace {1} by aggregates[i].label instead of aggregates[i].member?
I use free jqGrid version 4.13.7
The pivot options:
var pvConfig = {
footerTotals: true,
footerAggregator: "sum",
totals: true,
totalHeader: "Tổng cộng",
totalText: "{0} {1}",
useColSpanStyle: true,
xDimension: [
{ dataName: 'ten_vt', label: 'Tên vật tư', width: 150, },
],
yDimension: [
{ dataName: 'ma_ct_gd', totalHeader: '' },
],
aggregates: [
{ member: 'du_dau', aggregator: 'count', summaryType: 'count', label: 'Dư đầu' },
{ member: 'du_cuoi', aggregator: 'sum', summaryType: 'sum', label: 'Dư cuối' }
]
}
And the result like
You can use totalText
as callback function instead of the template "{0} {1}"
. Try to use
totalText: function (options) {
return options.aggregate.aggregator + " - " + options.aggregate.label;
}
Additionally I would strictly recommend to upgrade to the latest released version of free jqGrid. It's currently the version 4.14.0. There are no version 4.13.7, but it was preliminary version "4.13.7-pre"
, which have to be specified with the build date. The code, which you use could be unstable. I make the build on any changes in GitHub code. Thus you use currently some unstable version from GitHub with some state between 4.13.6 and 4.14.0. In any way, it's supported only the latest released version (4.14.0) or the latest code (today state) from GitHub.