Search with or without comma/dot/space

Search with or without comma/dot/space

zoha520zoha520 Posts: 2Questions: 0Answers: 0
edited June 2013 in General
Hello!!
Thanks for the great functionality of datatable!! it is awesome!!

I need to search a client side table with or without comma, dot or space
for instance i have a column amount (with values 1,200.00 EUR / 67,201.03 EUR) . the user should be able to search 1200 or 120000EUR and get record with 1,200.00 EUR as search result. (and searching with 1,200 would be still valid)

I have seen that i can use fnFilter to remove the named characters but i dont know how to remove them from the data so that datatable will find the match...
I think removing all commas, dots or spaces from all columns should help me

Your help is very much appreciated! :)

Replies

  • zoha520zoha520 Posts: 2Questions: 0Answers: 0
    I found the solution! :)
    just adding
    [code] $.fn.dataTableExt.ofnSearch['mystype'] = function ( sData ) {
    return sData.replace( /,/g, "" ).replace(/\./gi, "").replace(/\s+/g, "");
    }[/code]
    will do the job!
    Datatable is amazing!!
This discussion has been closed.