DataTables SearchPane rendering
DataTables SearchPane rendering
shavertech
Posts: 4Questions: 1Answers: 0
Link to test case: https://codepen.io/shavertech/pen/qBLByOR
Debugger code (debug.datatables.net):
Error messages shown: N/A
Description of problem: I'm using the SearchPanes extension of DataTables, and having a bit of trouble understanding how to render links in the table, but not in the SearchPane. Any documentation I've come across has said that the type in panes should be filter, while the table is display.
Replies
Thanks for the test case. I took a look but I'm not clear what the issue is. Could you describe what you'd expect to happen, and what you're seeing instead!
Colin
Hi Colin, the issue is that the SearchPane is showing the text as links, but I only want the table to show the links. I tried to use the render function to handle that difference, but it doesn't seem to work with the "filter" type.
"render": function(data, type, row, meta) {
if (type === 'filter') {
return data; // Show original text in searchPane
} else {
return '<a href="' + row.Link + '">' + data + '</a>'; // Render link in displayed table
}
}
Ah I see, thanks for the explanation.
You need to do two things.
First, the code above is slightly wrong, it would be better as:
Then, when you define the SearchPanes data for that column,
I tried updating your example to demonstrate, but couldn't work out how to fork it!!
Colin