I have a jquery DataTable that has a column whose data is 1 or 0. I, through the render method, change said value for an image in the following way:
"columns": [
{data: 'codigo'},
{data: 'tipolote' },
{data: 'activo', width: '10', className: 'text-center',
'render' : function(data, type, row) {
return (data == 1) ? '<span class="glyphicon glyphicon-ok"></span>' : '<span class="glyphicon glyphicon-remove" value="0"></span>';
}},
...
]
The drawback is that when I type something in the search textbox of the DataTable, an error is generated. If I remove the Active column, the search is done correctly, filtering what corresponds. I understand that when I remove the value 1 or 0 and put an image, I lose just the value and cannot do the search. Is there any way to remedy this problem?
It does not filter because there is no text to filter, what you can do is place a
label
hidden label with text, in this case your text would be 0 or 1.and leave your code like this:
I leave you the example: