Author Topic: Filter questions  (Read 7251 times)

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Filter questions
« on: December 19, 2018, 03:19:26 pm »
As I understand the built in filters is available based on the dataType set (if not specified in filter).
Currently I seem to get same list for 'string' and 'integer'...?

Also would it be possible to set filter condition back to the default by the user? (as set in crules).
'--None--' seems to do nothing.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Filter questions
« Reply #1 on: December 20, 2018, 11:27:08 am »
1. FIlter options are still based on dataType, only that the support is widened ( compared to older versions <5.2 ) to support as much options as possible for a given dataType.

e.g. contain ( which normally applies to strings ) can find 000 from numbers 5600045,
"Mon" from dates "Monday 20, 2000"
"/20/" can find all dates with format "mm/dd/yy" whose day is 20,

begin: "05"  can find all dates with format "mm/dd/yy" whose month is May, etc

2. Noted, would be taken care of in upcoming versions.
« Last Edit: December 20, 2018, 11:41:27 am by paramquery »

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Filter questions
« Reply #2 on: December 21, 2018, 04:47:04 pm »
Thanks. Would it be possible to use 'equal' and 'notequal' as non range options (let user enter search criteria)?

Use case:
User wants to select all rows that do not have value '0'.
But I want to avoid loading all distinct values as options. Also it might be a lot of values to scroll to find the wanted one.


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Filter questions
« Reply #3 on: December 21, 2018, 05:43:21 pm »
You mean you want textbox instead of dropdown for equal and not equal conditions.

It's answered here

https://paramquery.com/forum/index.php?topic=3008.msg11362#msg11362

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Filter questions
« Reply #4 on: December 21, 2018, 06:47:48 pm »
Great, is it possible to affect specific column(s)?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Filter questions
« Reply #5 on: December 21, 2018, 07:14:01 pm »
Yes, please add this to column definition:

Code: [Select]
         filterFn: function(ui){
if(ui.condition=='equal'){
return {
type:'textbox',
attr: "autocomplete='off'",
style: "cursor:auto;",
init: function(){
//return true to override internal initialization
return true;
}
}
}
}

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Filter questions
« Reply #6 on: March 04, 2019, 02:32:01 pm »
If I use:

Code: [Select]
pq.filter.conditions.equal.filterFn = function(ui){
  return {
type: 'textbox'
  }
}

How can set specific columns to override and use built in dropdown behaviour?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Filter questions
« Reply #7 on: March 05, 2019, 01:02:02 pm »
it can't be overridden.

If you want some columns to have dropdown while others to have textbox for the same condition "equal", please assign this to the columns with textbox.

Code: [Select]
         filterFn: function(ui){
if(ui.condition=='equal'){
return {
type:'textbox',
attr: "autocomplete='off'",
style: "cursor:auto;",
init: function(){
//return true to override internal initialization
return true;
}
}
}
}

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Filter questions
« Reply #8 on: March 05, 2019, 07:16:21 pm »
Works fine, but there seems to be an issue when you try to set multiple conditions it still display range options (single select).

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Filter questions
« Reply #9 on: March 05, 2019, 07:29:52 pm »
Not sure what you mean by multiple conditions ( in what context? ).

Could you please elaborate and share a jsfiddle.
« Last Edit: March 05, 2019, 07:33:43 pm by paramquery »

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Filter questions
« Reply #10 on: March 05, 2019, 08:26:28 pm »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Filter questions
« Reply #11 on: March 06, 2019, 09:08:02 pm »
Ok got it, per column solution to use textbox for equal condition is working in header filter row only, not in filter menu dropdown. I've marked this feature for further working on it.

Currently you might have to rely only on global replacement.

Code: [Select]
pq.filter.conditions.equal.filterFn = function(ui){
  return {
type: 'textbox'
  }
}