Author Topic: Force equal filter to textbox  (Read 2660 times)

orlando_acevedo

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 27
    • View Profile
Force equal filter to textbox
« on: December 05, 2018, 05:58:18 am »
Hi pqTeam,

I recently upgraded to version 5.6 and ran into a problem with an infinite scrolling grid I created previously.
The ID field is an integer, and I had set the filter condition to 'equal', which makes that column's filter to become a dropdown. I tried to force it to be a textbox by adding the "type: 'textbox'" inside the filter object, but it does not work. The problem is that since this is an incremental load, I cannot use a dropdown because it would be limited to the records already loaded, and when I change the filter condition to anything other than equal, I get an error because 'StartsWith' is not valid for Int32 types.

Thank you,

OA

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6265
    • View Profile
Re: Force equal filter to textbox
« Reply #1 on: December 05, 2018, 09:25:53 pm »
filter.options can be pre filled upfront from database as asked by you in other post.

orlando_acevedo

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: Force equal filter to textbox
« Reply #2 on: December 05, 2018, 10:43:14 pm »
Thank you for your reply.

I do not want to have the options prefilled. I want to be able to enter the ID in the filter textbox and then use the change listener to pull that single item from the database.

Is it possible to force a textbox instead of a drop-down when the filter condition is "equal"?

Thank you,

OA

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6265
    • View Profile
Re: Force equal filter to textbox
« Reply #3 on: December 06, 2018, 10:35:22 am »
Please add this before initialization of grid to make it use plain textbox instead of dropdown for equal condition.

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

orlando_acevedo

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: Force equal filter to textbox
« Reply #4 on: December 06, 2018, 10:37:45 pm »
That worked.

Thank you very much.

 OA