How to call preDraw event manually?

How to call preDraw event manually?

marinashestuninamarinashestunina Posts: 2Questions: 1Answers: 0
edited April 2014 in DataTables 1.9
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

Replies

  • allanallan Posts: 54,914Questions: 1Answers: 8,608 Site admin
    > How to call preDraw event manually?

    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
This discussion has been closed.