Search code examples
persistencetabulator

Tabulator column.setWidth() not saving to history


I have a headerMenu dropdown to "show" and "hide" columns, and persistence is set to true. When I manually resize the columns the new width is persistent, but it is not when using the dropdown (the column does resize, however, it just doesn't stay that way on the next reload). I noticed that the columnResized callback is also not triggered by my code.

var headerMenu = [
    {
        label:"Hide Column",
        action:function(e, column){
            column.setWidth(40);
        }
    },

Am I missing something here? How do I get this to work and be persistent?


Solution

  • This is the correct behaviour, and fairly standard across a range of table functions and callbacks

    Both the callback and the persistence module only track user interaction with the table. This allows maximum flexibility for the developer to call additional functions on the table with out interfering with the direct user experience.

    In your case you appear to be trying to hide a column by changing its width? there is a hide function you can call on a column to hide it, if that is what y0u are attempting.

    column.hide()