Custom filtering - range search not working because of £ signs

Custom filtering - range search not working because of £ signs

DanjmDanjm Posts: 4Questions: 3Answers: 0
edited March 13 in Free community support

I have applied custom filters to my tables using this method, with the aim of being able to limit the max price of the items.

https://datatables.net/examples/plug-ins/range_filtering.html

I came across problems since my data is prices, meaning it includes the £ sign. I was wondering what is the best method of having it filter prices despite that symbol. I can imagine checking if the values "isNaN" is what's causing the issue, but I have very little experience working in Javascript. Any help would be appreciated.

Thank you

Answers

  • allanallan Posts: 46,595Questions: 1Answers: 6,507 Site admin

    You'd need to strip the £ symbol before converting the string to a number in the search function value.replace('£', '') should do that.

    Allan

Sign In or Register to comment.