2

I got a column with filter type textbox and i got filterrow enabled but i need the filter conditions dropdown to also appear next to the textbox because i need to be able to apply multiple conditions like not equal and other filters.

Ibrahim Ahmed
  • 2,295
  • 4
  • 21
  • 35

1 Answers1

0

It seems like it is possible, but only by making changes to the jqxgrid.filter module, which the licensing seems to allow. I base this answer on the code for jQWidgets v3.4.0. (Of course, it's convenient to de-minify the code first.)

There are switch statements in several functions which switch on the filtertype (such as number and textbox). You can define your own filtertype that shows a textbox with a dropdown list by choosing a new name and adding case statements to fall through to the number case in the function definitions _updatefilterrowui, clearfilterrow, and refreshfilterrow. For the function _addfilterwidget, you need to add your own case and copy the code for the number case, but replace the line saying

var A = F._getfiltersbytype("number");

with

var A = F._getfiltersbytype("string");

to populate the dropdown list with the string comparison operators – or you can define your own filtertype, but this of course requires additional adjustments. In the function _applyfilterfromfilterrow you also need to add a case based on the code for the number case, with some adjustments. Basically, what seems to do the trick is to firstly remove the part about the decimal separator and secondly to not typecast the input string by changing

y = k.createfilter(d, new Number(p), w, null, u.cellsformat, C.gridlocalization);

to

y = k.createfilter(d, p, w, null, u.cellsformat, C.gridlocalization);

Note that this answer is possibly not complete, as I haven't done extensive testing (but I am interested to know of any problems, as I am looking for the same functionality as BeyondProgramming).

RobV
  • 185
  • 4