fnUpdate when there are "action" columns
fnUpdate when there are "action" columns
blockhead
Posts: 4Questions: 0Answers: 0
I have table set up with two "action" columns, for editing and deleting.
So my table looks like this:
[code]
aaData: this.model.schools.toJSON(),
aoColumns: [
{
mDataProp:'schoolName'
},
{
mDataProp: null,
fnRender: function() {
return 'Edit';
},
bSortable: false
}
]
[/code]
When I try to use fnUpdate like this
[code]fnUpdate(school,nRow)[/code]
I get an error:
[code]
Requested unknown parameter 'schoolName' from the data source for row 1
[/code]
Tracing this through the code, the code seems to be going in an infinite loop, because _fnGetCellData is returning null for the action column,
and null is an object so [code]else if ( typeof mData == 'object' )[/code] is true
and it thinks this is an object we have to loop through again for set each individual cell.
So my table looks like this:
[code]
aaData: this.model.schools.toJSON(),
aoColumns: [
{
mDataProp:'schoolName'
},
{
mDataProp: null,
fnRender: function() {
return 'Edit';
},
bSortable: false
}
]
[/code]
When I try to use fnUpdate like this
[code]fnUpdate(school,nRow)[/code]
I get an error:
[code]
Requested unknown parameter 'schoolName' from the data source for row 1
[/code]
Tracing this through the code, the code seems to be going in an infinite loop, because _fnGetCellData is returning null for the action column,
and null is an object so [code]else if ( typeof mData == 'object' )[/code] is true
and it thinks this is an object we have to loop through again for set each individual cell.
This discussion has been closed.
Replies
try setting sDefaultContent on that column and see if that avoids the error (jquery.dataTables.js:6595)
Allan