I have tried doing so with regular expressions. Is there a simple way to filter a column based on the number of characters in the cell?
Thanks for your help.
Jeremy
Not internally in DataTables. Can you can do is simply call fnFilter only when the input is a certain length, so you'd use your own event handler. e.g.:
Ok, after looking this over more closely, this actually wont work for me. I dont think i did a good job explaining what I am trying to accomplish.
I have a single column of serial numbers.
I have a drop down that calls an eventhandler.
in the eventhandler I need it to filter the column.
The first criteria is that every cell has to start with the letter P
the second criteria is that the text in the cell has to be exactly 5 characters. if its 6 characters etc it gets filtered out.
I presume that it is a `select` list. What are the options in the list. You might need to use fnFilter with a regex filer, or perhaps ultimately custom filtering.
yes its a select list. The option simply states 'End of Life' which means any serial number starting with P and contains 4 numbers plus the P for a total of 5 characters.
ya im using $.fn.dataTableExt.afnFiltering.push that does date range filtering...
Replies
[code]
if ( $('#myInput').val().length > 3 ) {
table.fnFilter( $('#myInput').val();
}
[/code]
Allan
Really fantastic resource you've created here...
I have a single column of serial numbers.
I have a drop down that calls an eventhandler.
in the eventhandler I need it to filter the column.
The first criteria is that every cell has to start with the letter P
the second criteria is that the text in the cell has to be exactly 5 characters. if its 6 characters etc it gets filtered out.
thanks
I presume that it is a `select` list. What are the options in the list. You might need to use fnFilter with a regex filer, or perhaps ultimately custom filtering.
Allan
ya im using $.fn.dataTableExt.afnFiltering.push that does date range filtering...
[code]
table.fnFilter( '^P\d\d\d\d$', null, false );
[/code]
to do a regex filter which matches your description.
Allan