Fix: correct row data when using DataTables fnRowCallback i.c.w. fixedColumn extension

Fix: correct row data when using DataTables fnRowCallback i.c.w. fixedColumn extension

bscheperbscheper Posts: 1Questions: 0Answers: 0
edited March 2015 in Free community support

Hi,
We are using knockoutJS in combination with DataTables. In our own KnockoutJS bindinghandler, for the DataTables plugin, we registered a fnRowCallback function to generate the row columns with Knockout HTML templates.

After using the fixedColumns extension, the data that was shown in the fixed columns wasn't what we expected. The fixedColumn extension doesn't use the fnRowCallback function to generate the left or right columns table.

This fix will clone the already generated HTML, coming from our fnRowCallback, and shown the correct row data in the left columns.

In the "_fnClone" function there is a line of code:
var aTds = that.s.dt.aoData[i].anCells || that.s.dt.oApi._fnGetTdNodes( that.s.dt, i );

And i replaced it with:

var dtApi = new $.fn.dataTable.Api(that.s.dt); var aTds = dtApi.row(i).node().children;

This discussion has been closed.