DataTablesSrc icon indicating copy to clipboard operation
DataTablesSrc copied to clipboard

"Cannot read property 'id'" of nTr error

Open liquidaty opened this issue 6 years ago • 1 comments

This issue can occur when a $row.data(new_data) is called on a row whose TR element has not been rendered (e.g. my table has 500 rows, I've only rendered the first page, and I'm going to modify row 350). The offending line is in api.rows.js:

		if ( $.isArray( data ) && row.nTr.id ) {
			_fnSetObjectDataFn( ctx[0].rowId )( data, row.nTr.id );
		}

Assuming that _fnSetObjectDataFn does not need to be called in these circumstances, would the below change be sufficient to fix the issue?

		if ( $.isArray( data ) && row.nTr && row.nTr.id ) {
			_fnSetObjectDataFn( ctx[0].rowId )( data, row.nTr.id );
		}

liquidaty avatar Sep 15 '19 19:09 liquidaty

Hi - thanks for posting this. Can you link to an example showing the issue please?

Thanks, Allan

DataTables avatar Sep 15 '19 21:09 DataTables