ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: atmaneuler on February 19, 2021, 11:54:23 am
-
- I want to filter from date to date but if the value in the column is mm.dd.yy then it will filter correctly, if the value in the column is mm.dd then the filter will be false and no rows to display.
- The returned API is in the form yyyy-mm-dd(Ex: 2020-01-15) and then reformatted
--> Expectation: The column shows only the mm.dd value, but filters correctly
{
title: 'CS1',
dataType: 'date',
dataIndx: 'cs1',
format: 'mm.dd', //Format mm.dd then filter will be wrong, Format mm.dd.yy then filter will be true. But I just want to display mm.dd and the filter is still correct
align: 'center',
valign: 'center',
hvalign: 'center',
style: this.styleCell(),
styleHead: this.styleHead(),
sortable: false,
filter: { crules: [{ condition: 'between' }] },
render: (ui) => this.renderCell(ui),
},
-
Currently filtering doesn't work correctly without year in the format, I'm looking into the feasibility to support it in upcoming versions.
-
Here is the solution for your requirement:
Please use column.render instead of column.format to display dates in 'mm.dd' format.
render: function(ui){
return $.datepicker.formatDate("mm.dd", new Date(ui.cellData))
},
Please let me know if it doesn't solve your requirement.
-
When I add your command to my command line, my grid page doesn't load at the same time with an error message.
Code:
{
title: 'CS1',
// width: 65,
dataType: 'date',
dataIndx: 'cs1',
format: 'mm.dd',
align: 'center',
valign: 'center',
hvalign: 'center',
style: this.styleCell(),
styleHead: this.styleHead(),
sortable: false,
filter: { crules: [{ condition: 'between' }] },
render: function(ui) {
return $.datepicker.formatDate('mm.dd', new Date(ui.cellData))
}
},
-
In Angular, you would have to add this import.
import $ from 'jquery';