Change layout/presentation in mRender - cache struggle

Change layout/presentation in mRender - cache struggle

kktoskktos Posts: 11Questions: 0Answers: 0
edited October 2013 in DataTables 1.9
Hi all,
I'm wondering if there is a proper way to change the rendering of a table on-the-fly.
Let's say I have a table with a full view, with pictures and so on.
I wish to allow the user to have a compact view with less info and no picture.
Using a flag to tell the mRender functions to display a compact view or a full view is not working.
And that's normal. The dataTable cache is active then only the first call will be type='display'.
Every other fnDraw will call type='order'.
Important: it's not a ServerSide table and I don't want to clear the table and re addData.

Any suggestion on the proper way ? I can try to flush DT cache but I wish to use the politically correct way.

cheers.
/tm

Replies

  • kktoskktos Posts: 11Questions: 0Answers: 0
    ok, here is the solution I found. let's hope it's ok as I'm using DT internals:
    [code]
    var idx,
    len,
    list= oTable.dataTableSettings[0].aoData;

    for(idx= 0, len= list.length; idx
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    edited January 2017
    That looks probably about as good as it gets in DataTables 1.9-, however, 1.10 has an `invalidate` method ( `rows().invalidate()`) which are designed for exactly this kind of thing. Call the invalidation and the renderer will run again, re-reading the data from the data source.

    Allan
This discussion has been closed.