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

Adding state config to checkbox in toolbar doesn't save correctly #10756

Open
marciogurka opened this issue Feb 6, 2025 · 0 comments
Open

Adding state config to checkbox in toolbar doesn't save correctly #10756

marciogurka opened this issue Feb 6, 2025 · 0 comments
Labels
bug Something isn't working forum Issues from forum OEM OEM customer

Comments

@marciogurka
Copy link

Forum post

{
          ref: "showBaselineMenu",
          type: "button",
          text: "Show baseline",
          menu: [
            {
                id : 'baselineMenu1',
                type: 'check',
              text: "Baseline 1",
              statefulEvents : ['change', 'resize'],
              stateId,
              stateful: ["checked"], // this doesn't save the state of the menu item
           
              onToggle({ checked }) {
                
              }
            },
          ]
        }
  • When you reload the Gantt (change some code to trigger the reload), is expected to have the state saved, but that's not the actual result.

"Hi,

I could use some hints how to add state to this checkbox:

  class GanttToolbar extends Toolbar {
  static get configurable() {
    return {
      items: [
        {
          ref: "showBaselineMenu",
          type: "button",
          text: "Show baseline",
          menu: [
            {
              checked: true,
              text: "Baseline 1",
              stateful: ["checked"], // this doesn't save the state of the menu item
              stateId: "showBaselineMenuBaseline1",
              onToggle({ checked }) {
                toggleBaselineVisible(1, checked);
              }
            },
            // ... some more items
          ]
        },
      ]
    };
  }
}

elsewhere in the gantt initialiser code:

  StateProvider.setup("local");

The StateProvider works well for other stateful components (widths of columns are saved).

How to add menu item checkbox to the state?
"

@marciogurka marciogurka added bug Something isn't working forum Issues from forum OEM OEM customer labels Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working forum Issues from forum OEM OEM customer
Projects
None yet
Development

No branches or pull requests

1 participant