Editor Dropdown Filtering

Editor Dropdown Filtering

csdatumcsdatum Posts: 30Questions: 10Answers: 0
edited August 2017 in Free community support

I've got Editor server-side set up to handle drop-downs.
https://editor.datatables.net/docs/1.6.1/php/class-DataTables.Editor.Options.html

Unfortunately, when I use dt.column(x).search(str), it searches the VALUE, not the result of RENDER.

So if I have a dropdown containing <option value="1">Foo</option>, I have to search for "1", instead of "Foo". There should be a way to search for "Foo", correct?

The user will always see "Foo" and never see "1", so they will never know to search for "1".

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin
    Answer ✓

    I'm not sure what is going wrong here I'm afraid. If we take this example as a base, you can search for the label (since that is shown in the Location column).

    How does your code differ from that example? Can you link to your page so I can see it please?

    Allan

  • csdatumcsdatum Posts: 30Questions: 10Answers: 0

    Turns out that example had exactly what I needed!

    I had the client-side columns[].data option and the editor.fields[].name option set to the same thing. I needed to add a JOIN on the server-side, add the joined field to the editor instance server-side and put the joined table's field in the columns[].data option on the client-side.

    All good now, thanks a ton!

This discussion has been closed.