Enterprise: Add Tree restoreOriginalState() method

Created on 5 Sep 2018  路  8Comments  路  Source: infor-design/enterprise

Is your feature request related to a problem? Please describe.
A feature method to restore the original state of the entire Tree prior to any disabling/enabling/readonlyifying.

Describe the solution you'd like
The assumed solution is the ability to restore the original state of the entire Tree by preserving the initial state of the Tree before any actions are done to any node.

Describe alternatives you've considered

Additional context
Parent issue: #561 .

[5] type

Most helpful comment

@davidcarlsonberg I'm re-reading my comment there and realizing that I wasn't totally clear. What I was trying to convey was:

  • It should be possible to enable/disable each individual node on its own.
  • It should be possible to enable/disable the entire tree component as a whole. When re-enabling the tree component, any individual nodes that were previously (individually) set to disabled/readonly should be put back in that state.

I think those requirements are actually met by the work you did here though. If anything, it's more robust.

@tmcconechy for reference, the functionality I described above is present in Tabs, and has been asked for in Accordion before. Tree seemed like a good candidate for this as well.

All 8 comments

In other components we just used enable to make either readOnly or disabled enabled again, whats the difference between enable and restoreOriginalState ?

This method preserves any state disabled or enabled on any node from creation of the DOM and allows you to restore each node to that state in case any node state was changed. See this comment: https://github.com/infor-design/enterprise/issues/561#issuecomment-410749803

ok @EdwardCoyle do you mean "add the ability to restore enabled/disabled" to the state it was when the page was loaded? If so just noting we dont really have this anywhere else just enabled/disabled/readonly and then you just toggle the one you want and manage your own state.

So wondering if this is totally needed? It certainly doesn't hurt to add if done already though.

@davidcarlsonberg I'm re-reading my comment there and realizing that I wasn't totally clear. What I was trying to convey was:

  • It should be possible to enable/disable each individual node on its own.
  • It should be possible to enable/disable the entire tree component as a whole. When re-enabling the tree component, any individual nodes that were previously (individually) set to disabled/readonly should be put back in that state.

I think those requirements are actually met by the work you did here though. If anything, it's more robust.

@tmcconechy for reference, the functionality I described above is present in Tabs, and has been asked for in Accordion before. Tree seemed like a good candidate for this as well.

I'm happy to create another ticket for enabling/disabling individual nodes by ID if that's a desired functionality. Or can refactor existing to accept an argument of a single node and when not present, just do all. That would be the only functionality missing.
Would have to add styles to Tree if we want to disable ul.treeand have have enablement state cascade down without disabling each node.

You can currently disable nodes with the api so i think thats covered. http://master-enterprise.demo.design.infor.com/components/tree/example-disabled.html enough. I dont think we need to spend much more time than whats requested on the original ticket.

Just needs a second review then.

This ticket is now resolved. Closing out this GitHub ticket.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fitzorama picture fitzorama  路  17Comments

Fruko picture Fruko  路  31Comments

claudenbach picture claudenbach  路  39Comments

InforChloeChen picture InforChloeChen  路  18Comments

claudenbach picture claudenbach  路  17Comments