Skip to content

Resizing is gone after I update data and call updateConfig() and forceRender() #1476

Open
@uzername

Description

Describe the bug
You cannot resize table columns after you update data in table using updateConfig() and forceRender()

To Reproduce
On page load I initialize table data using server object and setting resizable: true. Like this:

grid = new gridjs.Grid({
    columns: listOfColumns,
    server: {
        url: "/Path/Data",
        method: "POST",
        body: serializeObject(somevalues),
        headers: {
            "Content-Type": "application/x-www-form-urlencoded",
        },
        then: (data) => data.map(
            (resultItem) => {
                /*code not related to question*/
            })
    },
    search:true,
    style: {
        th: { padding: '5px 10px' },
        td: { padding: '3px'}
    },
    resizable: true
}).render(document.getElementById("wrapper-dashboardtable"));

Data is showing OK and columns are resizable. Then I call updateConfig() and forceRender() to get another data from server, like this:

grid.updateConfig(
    {
        server: {
            url: "/Path/Data",
            method: "POST",
            body: serializeObject(completeObject),
            headers: {
                "Content-Type": "application/x-www-form-urlencoded",
            },
            then: (data) => data.map(
                (resultItem) => {
   /*some code here that prepares data from response to show them in columns. Not really related to question*/
                })
        },
        resizable: true
    }
).forceRender();

Data is shown but columns become non-resizable. Cursor changes shape but you cannot move column boundaries

Expected behavior
You should be able to resize columns after you update data from server using updateConfig() and forceRender(), if table was created with resizable: true

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome
  • Version Latest updated

Smartphone (please complete the following information):
Tried on desktop only

Additional context
I use server object to get data

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions