ParamQuery grid support forum
General Category => Suggest new features => Topic started by: omerix on August 19, 2019, 04:47:13 pm
-
Hello,
Pivot Grid De headers can't align left. (halign:left)
Although I reset total titles, it shows the title. Example: sum (Parti Sayısı)
Test Pivot SS : https://yadi.sk/i/1jvSVzRS1ljCOQ
,summaryTitle: {avg: '',count: '',max: '',min: '',stdev: '',stdevp: '',sum: ''}
,{title: 'Parti Sayısı', dataIndx: 'PartiAdet', minWidth: 60,dataType:'float',editable:false,format:'#,###',halign:'left'}
I'm using Version 6.0.
-
Pivoting generates new colModel which doesn't have same properties as original colModel.
pivotCM event can be used to modify / customize the colModel in pivot mode.
Example of pivotCM usage: https://paramquery.com/pro/demos/pivot_custom
-
There could be easy configuration property to copy original colModel properties to new colModel ( rather than relying on pivotCM event ) during pivoting.
and a callback for title?
-
I don't know if it's the right way. But that's how I cleared the words "sum, avg".
, pivotCM: function (evt, ui) {
cm = ui.CM;
cm.forEach(function (e) {
if (typeof e.colModel == 'object') {
e.colModel.forEach(function (e) {
e.title = e.title.replace('sum', '').replace('avg', '').replace('(', '').replace(')', '')
})
}
})
}
-
your solution seems to work fine as long as there are fixed number of group by columns i.e., level of nesting of columns, but it might break otherwise.
Columns().each() API could be used for more generic results.
pivotCM: function(evt, ui) {
this.Columns().each(function(col){
var cm = col.colModel
if(!cm || !cm.length) //last level column.
col.title = col.title.replace('sum', '').replace('avg', '').replace('(', '').replace(')', '')
}, ui.CM);
}
-
Thanks Param.