adding row does not cause table to auto-resize

adding row does not cause table to auto-resize

doncullendoncullen Posts: 32Questions: 2Answers: 0
edited October 2010 in Bug reports
Interesting stuff.

I have a table that is constantly changing with data being added, updated, removed from it (usually from AJAX data).

When new rows are added, auto-resize does not occur (when it *should* occur).

When rows are updated, auto-resize occurs (correct practice).

When rows are removed, auto-resize does not occur (and should not occur-- this is correct practice)

Adding fnDrawCallback(); right after adding doesn't cause it to auto-resize.

Is there a workaround in the meantime?

Replies

  • doncullendoncullen Posts: 32Questions: 2Answers: 0
    Update: bug still exists, but found a workaround:

    Add oTable.fnAdjustColumnSizing(); right after the line that adds the new row.

    Example:

    [code] $('#thetable').dataTable().fnAddData([
    something,
    somethingelse,
    anotherone
    ]);
    oTable.fnAdjustColumnSizing();[/code]
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Yup I suspect that this probably can be considered a bug - since fnUpdate does call it, as you say. I had been anticipating that you would simply call fnAdjustColumnSizing, like you now are. But I'm thinking that this is wrong... I'm planning a clean up of the API in the next major revision (or possibly DataTables 2, to try and not break too many applications...), and I'll make sure everything is consistent then. Until that happens, I've put it on my to-do list to think if this is a suitable change to the 1.7 api for a minor release (I suspect it is).

    Allan
This discussion has been closed.