passing input text to dateable column search

passing input text to dateable column search

Hazem123Hazem123 Posts: 4Questions: 2Answers: 0
edited June 1 in Free community support

Hello, I am trying to send an HTML input as text to:
table.column(1).search(searchQuery).draw();
however it seems to not like all type of text. So if my input is 1 it works fine. however if my input is a conditional statement
then it fails. for instance if my input is:
(d) => d > 1 && (d) < 3
it fails.
but if I do the following it works:
table.column(1).search((d) => d > 1 && (d) < 3).draw();

so I am assuming it doesn't handle text as I thought it did? or is there another trick to achieve this?

Thank you.

Answers

  • kthorngrenkthorngren Posts: 21,184Questions: 26Answers: 4,925
    table.column(1).search((d) => d > 1 && (d) < 3).draw();
    

    I haven't tried anything like this with column().search() but it seems it might return a boolean value. What are you expecting it to return? The (d) => d > 1 && (d) < 3 being passed into column().search() is a function. However when getting the value of an HTML input it will be a string. The string will need to be parsed into something you can use with column().search().

    Possibly I'm misunderstanding something. Please build a simple test case with an example fo your column 1 data and describe how you want to use the HTML input to search.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

Sign In or Register to comment.