gridjs icon indicating copy to clipboard operation
gridjs copied to clipboard

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

Open uzername opened this issue 1 year ago • 2 comments

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

uzername avatar Sep 27 '24 06:09 uzername

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 26 '25 02:04 stale[bot]

Any ideas on this?

uzername avatar Apr 26 '25 13:04 uzername