Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
uzername opened this issue Sep 27, 2024 · 0 comments

Comments

@uzername
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant