Coder Social home page Coder Social logo

RFC: Specify select feature about fancytree HOT 12 CLOSED

mar10 avatar mar10 commented on July 20, 2024
RFC: Specify select feature

from fancytree.

Comments (12)

xgqfrms avatar xgqfrms commented on July 20, 2024 1

fancytree-unselectable

my solution

result

json

    init: function (event, data) {
        data.tree.getRootNode().visit((node) => {
            if (!node.selected) {
                node.setSelected(true);
            } else {
                // console.log(`selected true=`, node.selected);
            }
            if (node.data.noselectable) {
                if (node.span.classList) {
                    node.span.classList.add("fancytree-unselectable");
                }
                node.unselectable = true;
            } else {
                // console.log(`unselectable false =`, nodedata.noselectable);
            }
        });
    },

from fancytree.

mar10 avatar mar10 commented on July 20, 2024

Closing RFC issues, because they should not appear as Open Issue.

This thread is still open for discussion!

from fancytree.

inquam avatar inquam commented on July 20, 2024

I was told in a mail this was still open to discussion and here it seems closed so I'm not sure what it is. But anyway. Since selecting a parent node (in selection mode 3) causes all children of that node to be selected to I feel it's expected behavior for the children to be selected even if they are loaded using lazy loading.

If you first expand the parent, then close it and select it all children are selected. To then have the children behave different just because the parent node has not been expanded at least once is not intuitive at all and only looks like something is wrong to the end user.

from fancytree.

mar10 avatar mar10 commented on July 20, 2024

thanks!
p.s.
see above:

Closing RFC issues, because they should not appear as Open Issue.This thread is still open for discussion!

from fancytree.

alleroux avatar alleroux commented on July 20, 2024

With selectmode=3 I am trying to query the selection status of a node. 'partsel' seems to be true for all nodes in a branch that has one or more nodes in the branch that are partially selected. Is this the intended behavior? My assumption was that partsel would be true only for parent nodes who had less than 100% of their child nodes being selected and one or more child nodes selected. Attaching an image to show you how I expected the attribute to function.

selected

from fancytree.

mar10 avatar mar10 commented on July 20, 2024

Currently 'partsel: true' means: 'at least on child is selected', so maybe 'hasSubSel' would have been a better name. 'selected: true' takes precedence, The logic is

if( node.selected ) {
    // selected
} else if( node.partsel } {
    // partially selected
} else {
    // unselected
}

from fancytree.

brumsel avatar brumsel commented on July 20, 2024

Is it possible to also set the unselectable via API? Perhaps like you set a node selected via API "node.setSelected(bool)" you could also provide a "node.setUnselectable(bool)" for instance. Looks like you can only set unselectable via the initializing (data loading) of the tree. Or am I overlooking something?

Regards

from fancytree.

mar10 avatar mar10 commented on July 20, 2024

@brumsel: basically it is node.unselectable = true; followed by node.renderStatus(), but you may open an issue for the feature request.

from fancytree.

brumsel avatar brumsel commented on July 20, 2024

Thanks for the reply. I think I will make a feature request. For now I will implement the renderStatus.

I also have another question. It concerns the hideCheckbox option. If I set this option to true in my json, the checkbox is still being shown. Do I have to do a node.renderStatus() as well after loading the json? How do I use the hideCheckbox option?

from fancytree.

mar10 avatar mar10 commented on July 20, 2024

renderStatus() should only be required, after a node.ATTRIBUTE was set directly using JavaScript.
If passed with JSON, it should not be required. If you found a bug there, pleas open an issue for this.

from fancytree.

brumsel avatar brumsel commented on July 20, 2024

Ok, got it working, no bug.
Is there some forum support where I can leave questions or do I have to post them on github?

from fancytree.

mar10 avatar mar10 commented on July 20, 2024

Questions should be directed to Stackoverflow or https://groups.google.com/forum/#!forum/fancytree

from fancytree.

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.