Hide data in fnRowCallback
Hide data in fnRowCallback
drakula1234
Posts: 58Questions: 1Answers: 0
I am hiding column when I initially display the table and it works like a charm. I have a search filter and when I enter text in the filter I get the all the values I am passing to the datatable. The table displays data from columns (1-5) instead of from (2-5). I am not sure how do I implement this in the fnRowCallback function. I need some help from the experts.
Thanks in advance
Thanks in advance
This discussion has been closed.
Replies
Allan
For security reasons I cannot give a link to the test case. No, I am not putting any text in the column. This is the code I have
[code]
"aoColumnDefs": [{"bVisible": false, "aTargets": [0]}],
"bAutoWidth": false,
[/code]
and I am using text highlight function written by another person in this forum. So I have that in the fnRowCallback function apart from what I pasted below.
[code]
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
$('td:eq(0), td:eq(1), td:eq(2), td:eq(3)', nRow).css("text-align", "left");
$('td:eq(4)', nRow).css("text-align", "right");
return nRow;
[/code]
After entering text in the filter, it does an ajax call to get the data from the server side. I have put a break point to check if the control comes to the aoColumnDefs after search text has been entered, the control directly goes to the fnRowCallback function. I am not sure if I have done right. Thanks for your time
Allan
What are you trying to change? If its just the visibility of a column use fnSetColumnVis - much more flexible :-). Most other options could probably be done with a plug-in as well (although in most cases, such plug-ins don't yet exist, but wouldn't be too hard to create).
Allan