Searching option: Not matching

Searching option: Not matching

PeacepipePeacepipe Posts: 9Questions: 4Answers: 0
edited September 2017 in Free community support

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

  • PeacepipePeacepipe Posts: 9Questions: 4Answers: 0

    /bump

  • kthorngrenkthorngren Posts: 20,142Questions: 26Answers: 4,736
    Answer ✓

    Sounds like you might need to use columns.render to pull the text out for the filter data type. Some examples can be seen here:
    https://datatables.net/manual/data/renderers#Functions

    Kevin

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Answer ✓

    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

  • PeacepipePeacepipe Posts: 9Questions: 4Answers: 0

    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

This discussion has been closed.