index column prints [object Object ]
index column prints [object Object ]
Hello Team,
when i click on Print button it shows [object object ] inside index column
debug file url : http://debug.datatables.net/okagug
index column : function : t.on('order.dt search.dt', function () {
t.column(0, { search: 'applied', order: 'applied' }).nodes().each(function (cell, i) {
cell.innerHTML = i + 1;
t.cell(cell).invalidate('dom');
});
}).draw();
what causing this ??
Please help !!!
This question has an accepted answers - jump to answer
Answers
I was going to say that you need to use
cell().invalidate()
, but I see you are already using that. As such I would need a test case showing the issue to be able to help debug the issue.Thanks,
Allan
Thanks for the Quick response Allan !!
As suggested test case url : http://live.datatables.net/woboviqi/1/edit
Super - thanks!
Its being caused by:
for the first column. That tells DataTables that it should use the original object for the row as the data source for the column. That's only useful when combined with
columns.render
.Instead, in this case what I think you should do is set
columns.data
to be a property that doesn't exist in the object (then DataTables will write to it whencell().invalidate()
is called) and usecolumns.defaultContent
to stop any error messages appearing:Updated example: http://live.datatables.net/woboviqi/2/edit
Allan
Thanks you very much allan . it works great !!!
one more question as my json does not contain any id column , how datatables process this line of code
{ 'data': 'id', defaultContent: '' },
It will attempt to read a property called
id
. When it finds that there isn't such a property it will just use the defaultContent (empty string in this case).When you call
cell().invalidate()
it will actually write the value into a newid
property.Allan