Git Product home page Git Product logo

Comments (5)

jtrussell avatar jtrussell commented on June 14, 2024

Sorry, not sure I'm following you. Would you mind creating an example using our template jsbin/plunkr/etc.? I added some tests to verify this is behaving as intended:

Keep in mind that if you are using ivhTreeviewMgr in your own code you must tell the manager which property it should use for expanding/collapsing (as in the last example).

from angular-ivh-treeview.

cgatesman avatar cgatesman commented on June 14, 2024

I did notice the optional overriding opts parameter. I guess I assumed using ivh-treeview-expanded-attribute as a directive attribute would behave the same way as setting expandedAttribute in the ivhTreeviewOptionsProvider--completely overriding the default behavior of that option and not require always passing in the override through the opts parameter.

The issue I see is that it doesn't make sense to have an ivh-treeview-expanded-attribute directive attribute if it does not use it at all times (like it does when setting expandedAttribute in the ivhTreeviewOptionsProvider).

from angular-ivh-treeview.

jtrussell avatar jtrussell commented on June 14, 2024

Specifying a new default option with ivhTreeviewOptionsProvider is just as you say: overriding a global default. We can safely use these new values everywhere.

The thing with the attribute level option is that it's local to a particular tree instance.

You can, for example, have multiple trees (that maybe even use the same data!) which each use different attributes for tracking expanded/collapsed states. So we want to keep these settings sandboxed.

Coupling view attributes to the service behavior would also create undesirable race conditions:

  • ivhTreeviewMgr.expand(...) --- uses existing defaults
  • view is processed
  • ivhTreeviewMgr.expand(...) --- now uses values specified in view...?

In general I don't think it's a great practice to assume your e.g. controller (or arguably worse, service) knows anything about your view - or even assume a particular view has been compiled and linked. So when you want to use ivhTreeviewMgr to manipulate tree data and that data has attributes which differ from the registered defaults, it's appropriate to have to provide that information to the manager.

from angular-ivh-treeview.

cgatesman avatar cgatesman commented on June 14, 2024

Thanks for the explanation. It makes sense. You can close this.

from angular-ivh-treeview.

jtrussell avatar jtrussell commented on June 14, 2024

Sorry for the confusion, I'll revisit the docs and see if I can make this behavior more clear.

from angular-ivh-treeview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.