Author Topic: paramquery grid date filter with null value  (Read 3891 times)

JUNZHONG

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 16
    • View Profile
paramquery grid date filter with null value
« on: April 07, 2016, 11:17:10 pm »
Hi,
We have date filter on the grid as -
{ title: "Next Cal", width: 165, dataType: "date", dataIndx: "NEXT_CAL",
                       render: function (ui) {if (ui.cellData == null) return null; else return $.datepicker.formatDate('mm/dd/yy', new Date(Date.parseExact(ui.cellData,'d-MMM-yyyy')));},
                        filter: { type: 'textbox', condition: "between", init: pqDatePicker, listeners: ['change']  }
                   },


This field allows null so we have few records with empty/null date.
When we filter with end date, the row with null date shows up too. It should not show up. Please help.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: paramquery grid date filter with null value
« Reply #1 on: April 08, 2016, 08:53:08 am »
This example http://paramquery.com/pro/demos/filter_header_local has empty values "" in the Shipped Date column.

It works fine, you can check by copying the between filter from Order date column to Shipped data column.

You might have to replace null values with ""

JUNZHONG

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: paramquery grid date filter with null value
« Reply #2 on: April 08, 2016, 07:36:26 pm »
I tried with "" empty date but still doesn't work for me. Your example work but not my code. Seems like it is getting converted to date "12/31/1969". Not sure why. We are using 2.2 version.

filterModel: { header: true, type: 'local' }
« Last Edit: April 08, 2016, 07:52:08 pm by JUNZHONG »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: paramquery grid date filter with null value
« Reply #3 on: April 11, 2016, 09:37:54 am »
It also works fine in v2.4

http://paramquery.com/pro/demos24/filter_header_local

Could you please share a jsfiddle.

JUNZHONG

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: paramquery grid date filter with null value
« Reply #4 on: April 13, 2016, 01:12:37 am »
I found the issue. I was using date.js which was causing all the issues.
Thanks for your help.