Reputation: 781
Here's a simplified version of my code:
$('#myTable').dataTable({
"ajax" : myURL + "/GetTableData",
"aoColumns" : {
{sTitle: "ID", bVisible: false},
...
{sTitle: "Full Name",
mData: null,
mRender: function (data, type, arrRowData) {
return mergeName(arrRowData[3],arrRowData[4],arrRowData[5])
}
},
...
{sTitle: "Column 10", mData: 14},
},
"aaSorting" : [ 0, 'desc']
}).yadcf([{ column_number: 10 }]);
The problem is, I have several columns with bVisible: false
which are not displayed, plus custom-defined columns such as "Full Name" above. Because of this, the mData index does not correspond to the actual displayed column index. I want to display the filter for "Column 10" (which is really column 14 in the row data), but the data that it's trying to filter is from column index (mData) 10, not 14. How can I specify the display column and the actual data column separately - is this possible? The only workaround I found so far is to hardcode the filter choices and pass them to yadcf using data: [...]
, but this approach is obviously suboptimal and only works in a limited number of scenarios.
Editing to add (maybe this is easier): how would I create a filter for the "Full Name" column so that the filter choices are correct? Right now it only shows the first name (arrRowData[3]
) because it apparently assumes that the original row data IS the whole column. But the strange part is, the filter does work on the whole column - so if I select "John" from the dropdown, it finds both John Smith and Bill Johnson.
Upvotes: 0
Views: 111
Reputation: 37061
You can place your filters inside a container div
/ span
and point yadcf column definition with filter_container_id or filter_container_selector , you can place your container anywhere you want (including table header)
Upvotes: 0