How to search only selected options inside html select field
How to search only selected options inside html select field
Hi ,
I have a html multi select field in one column of table, I want to search only selected options in select fields and not unselected ones . Its currently searching all the text inside select field.
Can anyone suggest how to do it ?
I have a html multi select field in one column of table, I want to search only selected options in select fields and not unselected ones . Its currently searching all the text inside select field.
Can anyone suggest how to do it ?
This discussion has been closed.
Replies
[code]
$.fn.dataTableExt.aTypes.push(
function ( sData )
{
var ishtml=sData.match(/.*<\/select>/gm);
if (ishtml)
{
return 'comments';
}
return null;
}
);
$.fn.dataTableExt.ofnSearch['comments'] = function ( sData ) {
return sData.replace(/.*<\/select>/gm, "");
}
[/code]
And added stype to columndef in .dataTable( { } )
[code]
"aoColumnDefs": [{ "sType": "comments", "aTargets": [ 8 ] }],
[/code]
It will remove text inside select from search. Then I will use jquery to add selected options to hidden div outside of select field to let them available in search.
But this is still considering select field text in search.
Any ideas? Please let me know if any one can help.