ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: queensgambit9 on February 07, 2016, 09:02:09 pm

Title: filter in column with datatype integer
Post by: queensgambit9 on February 07, 2016, 09:02:09 pm
Hi

I use in ColModel

...
dataType: "integer", filter: { type: 'textbox', condition: 'begin',
...

when I use condition: 'contains' I get error: "Uncaught TypeError: f is not a function"

How can I use datatype integer and filter with contains condition?

thanks


Title: Re: filter in column with datatype integer
Post by: paramvir on February 08, 2016, 10:27:36 am
contain condition works with dataType: string

Callback could be used for numbers:
Code: [Select]
condition: function(a, b){
if ( ( a + "" ).indexOf( ( b + "" ) ) >= 0 ){
return true;
}
},
Title: Re: filter in column with datatype integer
Post by: queensgambit9 on February 08, 2016, 03:10:02 pm
tried:

Code: [Select]
{title:"columnd", width:90, dataIndx: "columnd", dataType: "integer", filter: { type: 'textbox', condition: function(a, b){
    if ( ( a + "" ).indexOf( ( b + "" ) ) >= 0 ){
        return true;
    }, listeners: ['keyup']}
}},

doesn't work...where to place the callback to function properly?

thanks
Title: Re: filter in column with datatype integer
Post by: paramvir on February 08, 2016, 05:30:17 pm
Please recheck:

Code: [Select]
condition: function(a, b){
      b = isNaN(b)? "": b+"";
        a = a+"";
        if ( !b.length || a.indexOf( b ) >= 0 ){
               return true;
        }
},


http://jsfiddle.net/b6b710mz/116/

Note that leading zeros are ignored with this method e.g., if 051 is entered in textbox, it would search for 51 in the cells.