SearchPanes treat Comma Separated String as Separate Options?
SearchPanes treat Comma Separated String as Separate Options?
Is it possible to have SearchPanes treat a column that is a comma separated string as separate entries? I know from the examples, you can take an array in the data and have it accomplish that, but what about the other way around?
The data I have is already listed out as a single string and I would like SearchPanes to list those out separately. For example if the data has "Item1, Item2, Item3" rather than having it listed in the SearchPane that way, can it recognize it as separate entries "Item1", "Item2", "Item3"?
I feel like it can be done based on the custom options or the rendering abilities, but I have yet to get it succesfully.
This question has an accepted answers - jump to answer
Answers
Is this what you are looking for?
http://live.datatables.net/tihareqa/1/edit
Its based on this exxample.
Kevin
That's exactly what I'm looking for...however it doesn't seem to work with my data coming from the ajax call... What I have for the ColumnDef is:
One data point as an example that gets returned for that column is:
"HELOC, ZIP4"
In the SearchPanes though...it still shows as follows:
Your example is exactly what I want it to do however.
Sounds like the
return data.split(", ");
is not executed. I would either use the browser's debugger or console.log statements to verify the column data and that theif (data != null && data.includes(", "))
is executing as expected. You can simulate the same functionality with a subset of your data and building a test case adding that data as a Javascript source, like this example. Then we can also take a look. You can update y example by removing the dom sourced rows and using your data.Kevin
I figured it out after debugging quite a bit, it appears I had a remnant of a columnDef I was using previously that was attempting to use class names to determine if the searchPane should show:
Once I removed that line, it started working as expected. I'm guessing that was overriding the column specific searchPane.
Thanks for all the help