Individual column seraching (Select Input) not working properly with html
Individual column seraching (Select Input) not working properly with html

I am using datatable in my table and my table td contains html(label) tags but dropdown is not showing unique values. How could we achieve that? Please check my Fiddle
This discussion has been closed.
Answers
You're getting console errors in this line:
You need to diagnose that - those
<label>
elements are only in the first column.Hi Colin
I have updated the Fiddle with complete HTML and everything is working fine except the thead dropdown not showing unique values.
Updated the <label> in html
I'm not sure if you pasted the right fiddle, but that's still giving the "Uncaught TypeError: Cannot read property 'split' of undefined", and the code looks the same.
Apologies for that Colin. I thought i saved it. Updated Link
Hi @harender_24 ,
The reason is because the column data is the data within the
<td>
element. In your case, this is:As the id is unique, you get both lines. You need to strip out the HTML element before checking for uniqueness.
Cheers,
Colin
Hi Colin
How should i check in datatable code? I tried to put before Unique() in Column.data() as column.data().text().unique() but, it is not working. Could you suggest?
See my last reply - the ID is preventing the data being unique. You need to form your own array of strings without the labels (you're doing it individually already to get the string for the
select
) - then do something like this to ensure uniqueness.