Apply $.fn.dataTableExt.afnFiltering to a DOM source datatable (on load from plugin)

Apply $.fn.dataTableExt.afnFiltering to a DOM source datatable (on load from plugin)

daniel_rdaniel_r Posts: 460Questions: 4Answers: 67
edited January 2014 in DataTables 1.9
Hi

I want to apply the range filter on a table that uses a DOM source, right now I achieve it by calling .fnDraw() on the table after $.fn.dataTableExt.afnFiltering.push call and it works fine, but I was wonder if there is a better more efficient way to do it.

For example in a sAjaxSource datatable I call the $.fn.dataTableExt.afnFiltering.push when table being initialized by the datatables constructor (before the draw event of the datatable is fired) so in the draw event the table being filtered thanks to the push I did to the $.fn.dataTableExt.afnFiltering.

So my question is: if I call my plugin in the following way: $(".my_table").datatables().myPLugin();, what would be the most efficient way to show the datatable filtered according to a range filter ($.fn.dataTableExt.afnFiltering.push)

b.t.w, I have values to push the the range filter because I'm reading those values from saved state (bStateSave --> oLoadedState) :)

Regards,

Daniel.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    If you are initialise the plug-in that way, I think inevitably you will need to call fnDraw, since the table will already have done a draw by the time the `dataTable()` part of the expression has been evaluated.

    You could possibly have your users to `myPlugin().dataTable()` to pre-set it up, but that might introduce further complications...

    Allan
  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67
    Ok, Thanks
This discussion has been closed.