Author Topic: Column head filters - find empty values in data  (Read 2104 times)

arborresearch

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 6
    • View Profile
Column head filters - find empty values in data
« on: February 22, 2017, 08:10:41 pm »
Sirs / Ma'ams,

I apologize ahead of time for what might be a simple answer; I just haven't been able to locate a workable answer by searching.

I have a simple column of data that contains text. However, some cells are empty. I'd like to be able to filter for these.

Here is my current code for the column:
Code: [Select]
filter: { type: 'select', condition: 'contain', prepend: { '': '--Select--','Consented': 'Consented','Refused': 'Refused', 'Missing':'Missing', 'empty':'Empty' }, valueIndx: 'consent',  labelIndx: 'consent', listeners: ['change'] }

Currently, it seems to work just fine, except for "empty". Well, of course not - there is no text in the cells that = 'empty'.

Some search results (Internet / forum) indicated that I could use a simple '' and that would find it. Well, not really. The first entry (above) already uses that {'':'--select'' ...}, and it seems simply not  to filter anything (removes all filters for that column), so that can't be the solution.

Right, so after some searching it appears that since I am using the 'contains' condition, this may be my issue.
Apparently there is a condition called 'empty', and another called 'notempty'.
These are interesting and would seem to permit me to find the empty cells. However, I don't know of a way to swap conditions  for that columns.

What are your thoughts on this, and what approach should I seek next?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6260
    • View Profile
Re: Column head filters - find empty values in data
« Reply #1 on: February 23, 2017, 12:30:46 pm »
contain condition can't be used for empty values.

As you need both conditions "contain" and "empty", you can implement custom filtering by using a callback.

This example shows how to implement custom filtering by use of a callback..

https://paramquery.com/pro/demos/filter_custom

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6260
    • View Profile
Re: Column head filters - find empty values in data
« Reply #2 on: May 12, 2017, 10:42:11 am »
arborresearch

There is a related post and sample code in this post:

https://paramquery.com/forum/index.php?topic=2110.0