How to call preDraw event manually?
How to call preDraw event manually?
marinashestunina
Posts: 2Questions: 1Answers: 0
I'm using dataTables with DOM datasource. On preDraw callback I'm truncating data in cells based on column header data attribute. Also I'm using handlebars templates which build this DOM datasource. I have some processing outside the datatable which modifies the datasource (it happens within handlebars logic and in fact changes table html property). I would highly appreciate if you can advise how can I refresh/update the whole table so preDraw event is called and truncation logic works.
The test case is here http://jsfiddle.net/fmmVb/4/
On page load data is truncated, after click on Click Me it is not (I'm not showing the handlebars usage as it really does the same - reassigns html of table).
Please note that I tried to
[code]var tableData = oTable.fnGetData();
oTable.fnClearTable();
oTable.AddData();
oTable.fnDraw();[/code]
but it is super slow and does not seem to work though.
Thanks,
Marina
The test case is here http://jsfiddle.net/fmmVb/4/
On page load data is truncated, after click on Click Me it is not (I'm not showing the handlebars usage as it really does the same - reassigns html of table).
Please note that I tried to
[code]var tableData = oTable.fnGetData();
oTable.fnClearTable();
oTable.AddData();
oTable.fnDraw();[/code]
but it is super slow and does not seem to work though.
Thanks,
Marina
This discussion has been closed.
Replies
There is no public API to do that - you need to either do it externally, or find a different solution.
Personally I would suggest you use fnDrawCallback here, since you presumably want to operate on the data that is shown on the script (pre draw occurs before that...!).
Allan