How to Exclude Controls from DataTables from Being Searched

How to Exclude Controls from DataTables from Being Searched

celbestercelbester Posts: 5Questions: 0Answers: 0

I have a dropdown list inside a table column which I hide and show whenever the user needs to edit. The limitation that I face is that whenever I need to search values on that column, it appears that DataTables is not filtering accordingly but actually it's because DataTables is also searching values found inside the hidden dropdown list.

Is it possible to "hide" the dropdown list from DataTables and exclude it from being searched by DataTables?

Replies

  • colincolin Posts: 9,003Questions: 0Answers: 1,501

    Hi @celbester .

    Is this with Editor?

    To do that, you could create a custom search plugin. Here is the documentation, and here are a few examples,

    Cheers,

    Colin

  • celbestercelbester Posts: 5Questions: 0Answers: 0
    edited October 2019

    Hi Colin, thank you for replying! Unfortunately, it's not with Editor because I need it a free version only. : |

  • celbestercelbester Posts: 5Questions: 0Answers: 0

    To add an example, in the below html, if I search for "Agenda", DataTables appears not to be filtering because it still sees "Agenda" from the hidden dropdown list.

    <table>
            <thead>
                <tr>
                    <th>File Name</th>
                    <th>Document Type</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td><span>EmailReply.pdf</span></td>
                    <td>
                        <span>Correspondence</span>
                        <select class="hidden">
                            <option value="Agenda">Agenda</option>
                            <option value="Correspondence" selected="selected">Correspondence</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td><span>MoM.pdf</span></td>
                    <td>
                        <span>Agenda</span>
                        <select class="hidden">
                            <option value="Agenda" selected="selected">Agenda</option>
                            <option value="Correspondence">Correspondence</option>
                        </select>
                    </td>
                </tr>
            </tbody>
        </table>
    
  • colincolin Posts: 9,003Questions: 0Answers: 1,501

    Have you tried the search plugin I suggested?

Sign In or Register to comment.