Searching option: Not matching
Searching option: Not matching
Hello,
I'm trying the functionalities of DataTable and I'm having the following issue:
This is an example of the data shown on the table:
As it can be seen, in the first column ("Serial"), there are two cases that begin with KD. Will try to search them:
In the result, none of them were found, I wonder how can this be fixed. As a side note, this column is marked as 'readonly' but that was not the issue.
Thanks
Update:
This is the code of a constructed row:
I have tried leaving the first column with the less number of elements possible except for the name:
But seems like none of them were the reason behind this.
Update 2
Also, tried adding a row manually with simple text manually written and that was successfully filtered. Maybe nothing that is inside an <input> can be read?
This question has accepted answers - jump to:
Answers
/bump
Sounds like you might need to use
columns.render
to pull the text out for thefilter
data type. Some examples can be seen here:https://datatables.net/manual/data/renderers#Functions
Kevin
The problem is that the table contains form elements. The value of them exists as a DOM property which can be read by Javascript. But DataTables is trying to use the HTML instead - e.g.
<input ...>
(and it strips tags).I'm afraid that this is not a situation where DataTables is particularly useful yet. The problem with having the form elements is that it is a serious performance issue, since it needs to get the values from the elements every time a search is performed in case they have changed. That is something I'll be adding support for in future, but at the moment a table full of form elements is not well supported.
Allan
Hello, Allan.
What I have done is add another
<
div> section inside the column and write in it @item.ElementX and also make it hidden.
With this the search option works because it uses the information inside this
<
div>.
It feels kind of rudimentary but well, it works.
Thanks