ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: queensgambit9 on April 20, 2019, 02:14:16 am
-
Ok, but how do you set the value as percentage and with thousand separator (# ###)?
Tried:
format: function(val) {
return (val * 100) + "%";
}
-
format: function(val) {
return pq.formatNumber(val * 100, "# ###") + "%";
}
-
Having issue with deFormat, how do I apply deFormat on the formatted value to make filtering work?
-
//use deFormat as counterpart of format callback
deFormat: function (val) {
return (pq.deFormatNumber(val.split("%")[0], "# ###") / 100);
}
Ex: Freight column in https://paramquery.com/pro/demos/filter_header_local
Please make appropriate changes if you have null/undefined values in the column
-
Thanks.
Using:
{ title: 'test', width: 130, dataIndx: 'test', dataType: 'float', hidden: false, filter: { crules: [{condition: 'between' }] },
format: function(val) { return pq.formatNumber(val * 100, '# ###') + '%'; },
deFormat: function (val) { return (pq.deFormatNumber(val.split('%')[0], '# ###') / 100); }
},
On loading the grid I get '0%' inserted in both filter fields.
I have no empty fields in column, and no errors reported.
Filter works fine when using it...but when sorting the column % sign is once again inserted.
See that its the same behaviour in your example...is that by design?
-
Filter fields for between condition can be kept empty instead of "0%" by updating format callback for empty values.
format: function (val) {
return (val==null || val==="")? "": (pq.formatNumber(val * 100, "# ###") + "%");
},
-
When sorting '%' sign is still inserted if filter is being applied....would that be possible to remove aswell?
-
'%' is part of the format as per your requirements, it's displayed in both filter fields and column.