ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: atmaneuler on February 19, 2021, 11:54:23 am

Title: Issue filter
Post 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),
      },
Title: Re: Issue filter
Post by: paramvir on February 22, 2021, 10:02:48 am
Currently filtering doesn't work correctly without year in the format, I'm looking into the feasibility to support it in upcoming versions.
Title: Re: Issue filter
Post by: paramvir on February 23, 2021, 06:10:57 am
Here is the solution for your requirement:

Please use column.render instead of column.format to display dates in 'mm.dd' format.

Code: [Select]
render: function(ui){
return $.datepicker.formatDate("mm.dd", new Date(ui.cellData))
},

Please let me know if it doesn't solve your requirement.
Title: Re: Issue filter
Post by: atmaneuler on February 24, 2021, 12:48:57 pm
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))
        }
      },
Title: Re: Issue filter
Post by: paramvir on February 24, 2021, 06:01:09 pm
In Angular, you would have to add this import.

Code: [Select]
import $ from 'jquery';