olifolkerd / tabulator

Interactive Tables and Data Grids for JavaScript
http://tabulator.info
MIT License
6.71k stars 818 forks source link

Table-Width isn't 100% on persistentLayout #405

Closed cschnelting closed 7 years ago

cschnelting commented 7 years ago

Hi Oli, I have a HTML-Page with two Tabulator-Tables. When I use the following tabulator-options, the #table1 is not rendered with 100% width. table1: movableColumns: true, persistentLayout:"cookie", persistentLayoutID:"table1", table2: movableColumns: true, persistentLayout:"cookie", persistentLayoutID:"table2",

If I remove this tabulator-options on table1, the Table is rendered correct with 100% Width. Do you have an Idea?

Thanks!

cschnelting commented 7 years ago

When I open the HTML-page the table1 is rendered correct with 100% Width. After reloading the Page, the Width isn't 100%. When I then delete the cookie and reload the Page, Width is 100% again, and the cookie is created. After reloading the page now again, the width isn't 100% .

olifolkerd commented 7 years ago

Could you post your entire tabulator constructor object so i can test against your exact setup.

Cheers

Oli

cschnelting commented 7 years ago

Hi Oli, I've solved that issue by using getColumnLayout and setColumnLayout and store/read it in/from a database instead of using persistentLayout:"cookie",.

olifolkerd commented 7 years ago

have you tried using persistentLayout:true it will choose the best method to store the layout info (local storage first if it can) which may solve your issue.

Is there any chance you could post your constructor object, i cant seem to replicate your issue and i want to make sure that if it is a bug it is fixed and wont affect anyone else.

Cheers

Oli

cschnelting commented 7 years ago

Hi Oli,

I've tried persistentLayout:cookie with the following constructor object:

$(function() {
    $("#grid").tabulator({
        height:"85vh",
        fitColumns:true,
        movableColumns: true,
        persistentLayout:"cookie",
        persistentLayoutID:"myGrid",
        selectable:1,
        selectablePersistence:false,
        pagination:"remote",
        paginationSize:25,
        ajaxURL:"../query?relation=myGrid",
        columns:[
            {title:i18n('id'), field:"id", sorter:"string", headerFilter:true, editor:ajaxFilterInput, editable:notEditable},
            {title:i18n('typ'), field:"typ", sorter:"string", headerFilter:true, editor:ajaxFilterInput, editable:notEditable},
            {title:i18n('status'), field:"status", sorter:"string", headerFilter:true, editor:ajaxFilterInput, editable:notEditable},
            {title:i18n('datum'), field:"datum", sorter:"string", headerFilter:true, editor:ajaxFilterInput, editable:notEditable},
        ],
    });
});

But now, i need to store the Layout user-dependent, so i store it in the Database. And since this, the error isn't occurred again.

olifolkerd commented 7 years ago

The issue you are probably having is that you have changed the formatter (or other column definition data) assigned to a column at some point during your development, if you alter the column definition while persistentLayout is enabled you need to either clear the cookie or change the persistentLayoutID value to prevent the table from loading cached column layout information that is no longer valid.