DataTables 2.0 Issue with node()

DataTables 2.0 Issue with node()

smcvay2005smcvay2005 Posts: 2Questions: 1Answers: 0

After upgrading to DataTables 2.0, I'm no longer able to access the node() property (I get undefined) in rows outside the scope of the current page of data. In previous versions, this code worked just fine to grab the desired data from EVERY row in the table. Now I'm only able to get the rows on the current page. How would I go about making this work correctly in 2.0? Here's an example:

var myTable = $('#tblManageStateForms').DataTable();
myTable.rows().every(function (rowIdx, tableLoop, rowLoop) {
var data = this.data();
var currentRow = $(this.node());

var checkboxItem = currentRow.find('.isCurrentForm');
var stateFormRecord = new Object();


stateFormRecord.IsCurrentForm = checkboxItem.is(":checked");

var checkboxForRowId = checkboxItem.attr("id");
var checkboxIdPieces = checkboxForRowId.split("_");
stateFormRecord.MSRStateFormId = checkboxIdPieces[1];
stateFormRecords.push(stateFormRecord);

});

All this code is doing is looping through the current table and getting information about a custom checkbox item that is in one of the columns (with the class name of "isCurrentForm").

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,327Questions: 26Answers: 4,949
    edited May 31 Answer ✓

    The default setting deferRender changed from false to true in 2.0. Try setting deferRender to false.

    Kevin

  • smcvay2005smcvay2005 Posts: 2Questions: 1Answers: 0

    Thank you! That seems to have done the trick.

Sign In or Register to comment.