[BUG ?] DeferRender not working when a column is hidden

[BUG ?] DeferRender not working when a column is hidden

WuigiWuigi Posts: 10Questions: 2Answers: 0

Hi,

After a few hours of debugging, I finally understood why deferRender isn't working on one of my tables: it seems that a table with a hidden (visible:false) column is completely rendered at first draw, regardless of deferRender.

Here is a simple JSfiddle illustrating the issue : http://jsfiddle.net/s2ujmcbx/1/

When you create the table with both columns visible, the render is only called on the visible 10 lines. When one is hidden (though it's not even the one with the render function), all the table is rendered.

Unfortunately, hiding the column after init is not even a workaround, as doing $('table').DataTable().column(1).visible(false) also renders the whole table.

Can you please confirm it's a bug (surely it doesn't seem natural) and if it can be fixed ?

Thanks !

Replies

  • WuigiWuigi Posts: 10Questions: 2Answers: 0
    edited April 2015

    Alright so this happens in _fnGetMaxLenString, which is indeed called by _fnCalculateColumnWidths only if there are hidden columns.

    I get that, to calculate columns width, the whole table needs to be rendered, but shouldn't this be deactivated with deferRender? Especially since it probably doesn't work as is (because the columns can't have their correct width with deferRender even with no hidden column, it doesn't seem really related, so the code for _fnCalculateColumnWidths seems only relevant in the case where deferRender is false, doesn't it?)

    Edit: so in the end the question is: shouldn't be autoWidth be set to false when deferRender is set to true? Or, at least, it would certainly be useful to precise in both options entries that their compatibility is not optimal and that autoWidth will partially cancel deferRender.

    Hope this helps :)

This discussion has been closed.