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

State of columns is not restored for columns w/o ids #6646

Closed
jsakalos opened this issue Apr 25, 2023 · 0 comments
Closed

State of columns is not restored for columns w/o ids #6646

jsakalos opened this issue Apr 25, 2023 · 0 comments
Assignees
Labels
bug Something isn't working resolved Fixed but not yet released (available in the nightly builds)
Milestone

Comments

@jsakalos
Copy link

jsakalos commented Apr 25, 2023

This is the related issue that was discovered by a React user. It also contains the showcase:

#6618

There are two possible solutions:

  1. Give user a warning if he uses columns without ids when the component is stateful (with stateId)
  2. Change the ids auto-generation login in Column.js. @ExtAnimal proposed such code and it works:
     generateId() {
        const { grid } = this;

        if (grid?.stateId) {
            if (!grid.generatedIdIndex) {
                grid.generatedIdIndex = 0;
            }
            return `${grid.stateId}-${this.field ? this.field.replace(/\./g, '-') : `column-${++grid.generatedIdIndex}`}`;
        }
        else {
            if (!Column.generatedIdIndex) {
                Column.generatedIdIndex = 0;
            }

            return (this.field ? this.field.replace(/\./g, '-') : 'col') + (++Column.generatedIdIndex);
        }
    }
@isglass isglass added this to the 6.0.0 milestone Apr 26, 2023
@isglass isglass added the breaking Breaking change label Apr 26, 2023
@ExtAnimal ExtAnimal added in progress ready for review Issue is fixed, the pull request is being reviewed and removed in progress labels Mar 20, 2024
@isglass isglass added bug Something isn't working resolved Fixed but not yet released (available in the nightly builds) and removed breaking Breaking change BLOCKING ready for review Issue is fixed, the pull request is being reviewed labels Mar 21, 2024
@isglass isglass modified the milestones: 6.0.0, 5.6.9 Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working resolved Fixed but not yet released (available in the nightly builds)
Projects
None yet
Development

No branches or pull requests

3 participants