DataTables 2.0 Issue with node()
DataTables 2.0 Issue with node()
![smcvay2005](https://secure.gravatar.com/avatar/2f943786ac027fc1a68f1e7aa6168603/?default=https%3A%2F%2Fvanillicon.com%2F2f943786ac027fc1a68f1e7aa6168603_200.png&rating=g&size=120)
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
The default setting
deferRender
changed from false to true in 2.0. Try settingdeferRender
to false.Kevin
Thank you! That seems to have done the trick.