Tabulator: add row title column

Created on 9 Mar 2017  路  2Comments  路  Source: olifolkerd/tabulator

good morning i am a beginner and i have a little problem with the add row table.
when the table load for the first time i have no title column but when i click to add row title appear.
i don't understand because all the data that will be load in the table are there but no header.
Sorry for my english i am french ;)

thank you

          success: function(data){

             $("#comment-admin").tabulator({

                height:"600px",
                pagination:"local",
                paginationSize:25,
                selectable:1,
                fitColumns:true,    

                columns:[
                    {title:"Asset Id", field:"assetId", width:100,sortable:true},
                    {title:"Utilisateur", field:"assetUser", width:500, sorter:"string"},
                    {title:"Commentaire", field:"comment", width:500,editable:true}
                ],
            });
            $("#comment-admin").tabulator("setData",data);
            $("#add-row").click(function(){
            $("#comment-admin").tabulator("addRow");
                });
Question - Ask On Stack Overflow

Most helpful comment

GREAT ! thank you very much
have a nice day :)

All 2 comments

Hey,

That is most likely because you are creating your table when it is hidden, so Tabulator cannot calculate the correct height for the column headers as they aren't visible yet.

You either need to create your Tabulator when its containing element is visible OR call the redraw method as the table is made visible to layout the column headers correctly:

$("#example-table").tabulator("redraw", true);

Let me know if that helps,

Cheers

Oli

GREAT ! thank you very much
have a nice day :)

Was this page helpful?
0 / 5 - 0 ratings