Column search in editor column of type 'select'
Column search in editor column of type 'select'
Hello Allan,
I have a column of type 'select' in my editor instance, which is populated by the controller with integer IDs as 'option' value and strings as 'option' text. Now when I try to search in this column with ...column(...).search(...).draw(...) it is just searching inside the option values, but I need the results for the texts.
Maybe one solution for me is to create another hidden column, where I will put out just the texts and where I can search in. But is there another possible (better) solution?
This question has an accepted answers - jump to answer
Answers
Can you give me a link to the page please? As you will be able to see in this example it should search the label if that is what is displayed in the DataTable.
Allan
I dont have an accessable example sorry.
Ok your example is nice. There you just take the 'name' property for output in datatables and the 'id' for the editor instance, to change the value.
In my version I used the 'id' also for the datatables output and then changed the output text with help of the render method. But the result is, that I cant search the texts but just the ids.
So the main problem when I change it to the way you solved it in your example would be, that I cant use the inline edit feature, because the field isnt connected to the right editor field (because of a different field name, if I understand this right?).
Can you show me that render method? Actually, if you could just show me the full initialisation and also some of the data you are using that would be great.
Thanks,
Allan
Ok here my abstract example:
The controller part looks like this:
In my script I init the editor:
and dataTables:
The result is, that the column search just searchs inside the TestTable.OptionId items but not the OptionsTable.Name. But I also need the inline edit feature for the editor, so I dont know if I just can change the dataTables columns -> data value from i.e. 'TestTable.OptionId' to 'OptionsTable.Name'.
Use:
See this page for an example, as well as
columns.editField
for reference documentation.Allan
Allan, you always have a solution for my problems. This is really a thoughtful finalized plugin! Thank you so much!