Code Monkey home page Code Monkey logo

Comments (29)

fuzunspm avatar fuzunspm commented on May 18, 2024 3

any news about this? I want to include not only checked leafs but their parent nodes in checked array

from react-checkbox-tree.

jakezatecky avatar jakezatecky commented on May 18, 2024 2

Model 3 has been fully implemented on the v1.6-dev branch. This can be activated by passing in checkModel="all" to the component. An alpha version of v1.6 has been published (1.6.0-alpha.0) should anyone wish to confirm the functionality or make use of it. A full feature release is planned for a later date.

It remains to be seen whether the second model will be included in the v1.6 release, as implementing its behavior is a bit awkward.

from react-checkbox-tree.

bikashkomprise avatar bikashkomprise commented on May 18, 2024 2

checkModel="all" does not work. I updated my package with src files from v1.6-dev

from react-checkbox-tree.

worthlutz avatar worthlutz commented on May 18, 2024 2

@jakezatecky I've done a little testing on v1.6.0-alpha.1 and checkmodel = all. It appears that only checkboxes which have the "black" check and not the "grey" check are listed in the checked array. Is this the intended result?

I am still thinking of the consequences of this. I suppose what matters is how the wrapping program uses the checked array. For me what usually matters is which node changed. This is usually the clicked checkbox or node and maybe all it's children depending on cascade status. If the parents and grandparents change, that is usually less or not important other than the visual changes in the tree.

I think I will put together some more test examples to expand my understanding of what is going on...

from react-checkbox-tree.

jakezatecky avatar jakezatecky commented on May 18, 2024 1

Model 3 is the one that can most easily be added. The second model would take more...thought. While some interest in Model 2 has been expressed, I can likely get a partial implementation with (Tesla) Model 3 in the next major release.

I have recently acquired some additional free time, so I think sometime before the end of this year is a good possibility. I am wrapping up some updates on one of my other libraries and then I will come back to this one.

from react-checkbox-tree.

ndaaktan avatar ndaaktan commented on May 18, 2024 1

checkModel="all" does works for v1.6

from react-checkbox-tree.

AliBayatMokhtari avatar AliBayatMokhtari commented on May 18, 2024 1

checkModel="all" does works for v1.6

It does not select all the parents and only select the first parent if and only if all the children of a parent are selected.

from react-checkbox-tree.

jakezatecky avatar jakezatecky commented on May 18, 2024

There are a few ways to go about here:

  1. Record leaf nodes in checked. Here, we only care about the leaf nodes. This is the current model.
  2. Record upper-most nodes in checked. Here, we care about top-most checked nodes; the component needs to be intelligent enough to only record nodes that do not have a parent node checked. This is the model you are suggesting.
  3. Record every checked node in checked. Here, we care about EVERY node selected, whether it is a parent, child, or leaf.

While the react-checkbox-tree component currently uses the first model, I do not see why we could not also support the other two models. Could be a component parameter.

from react-checkbox-tree.

qodesmith avatar qodesmith commented on May 18, 2024

Any progress on these models? I could use the 3rd one - "Record every checked node in checked".

from react-checkbox-tree.

jakezatecky avatar jakezatecky commented on May 18, 2024

@qodesmith No progress has been made. Much of the component makes assumptions about check state based on child nodes. Nevertheless, of the additional models, the third one you are wanting is the easier one to implement.

A PR is welcome. Otherwise, I'll get to this when I can. I certainly agree that it would be useful to have implemented.

from react-checkbox-tree.

VikramMaiya avatar VikramMaiya commented on May 18, 2024

Hi, The component designed by you is very useful but
Even I Wanted 3d functionality:
checked array must contain all the checked nodes including parents.
Awaiting your response.

from react-checkbox-tree.

VikramMaiya avatar VikramMaiya commented on May 18, 2024

Hi,
Currently I am using "react-checkbox-tree": "^1.0.1"

I tried updating to your V1.1.0:
npm install [email protected] --save

I got the following error:
No matching version found for [email protected]

from react-checkbox-tree.

williamboman avatar williamboman commented on May 18, 2024

@VikramMaiya There are no 1.1.0 release yet.

from react-checkbox-tree.

VikramMaiya avatar VikramMaiya commented on May 18, 2024

Hi William,
checked array must contain all the checked nodes including parents.
Could you help me ?

from react-checkbox-tree.

jakezatecky avatar jakezatecky commented on May 18, 2024

@VikramMaiya None of that is implemented yet. I only marked it for next release.

from react-checkbox-tree.

VikramMaiya avatar VikramMaiya commented on May 18, 2024

Hi jakezatecky,
Thanks for your quick response. How long will it take for the next release ?

from react-checkbox-tree.

karan-chauhan avatar karan-chauhan commented on May 18, 2024

Hi jakezatecky,
I also want all the checked nodes including parent, child. Can you please help me? And how long will it take for the next release..?

from react-checkbox-tree.

karan-chauhan avatar karan-chauhan commented on May 18, 2024

I solved some of my issue, but its not fully done. With this code, i can get the id of my parent, when i select all the values using parent. But if i deselect one of my child then it doesn't exclude the parent value from checked array. Here is the code that i changed:

key: 'toggleChecked',
        value: function toggleChecked(node, isChecked, noCascade) {
            var _this3 = this;

            if (node.children === null || noCascade) {
                // Set the check status of a leaf node or an uncoupled parent
                this.toggleNode('checked', node, isChecked);
            } else {
                //Change by karan
                this.toggleNode('checked', node, isChecked);

                // Percolate check status down to all children
                node.children.forEach(function (child) {
                    _this3.toggleChecked(child, isChecked);
                });
            }
        }

from react-checkbox-tree.

nusudoers avatar nusudoers commented on May 18, 2024

Any updates on the suggested models? I could really use the second option:
Record upper-most nodes in checked. Here, we care about top-most checked nodes; the component needs to be intelligent enough to only record nodes that do not have a parent node checked. This is the model you are suggesting.

from react-checkbox-tree.

gazu36 avatar gazu36 commented on May 18, 2024

@jakezatecky Any updates on this? The third option is an incredible plus for me and would love that to be an "official" addition

from react-checkbox-tree.

subhamayd2 avatar subhamayd2 commented on May 18, 2024

@jakezatecky Hi,
Thanks for the awesome component!! 😄
Although model 2 would be perfect, but is there at least any update regarding model 3?

from react-checkbox-tree.

joscmw95 avatar joscmw95 commented on May 18, 2024

I just coded up a fork that does model 2 (if I understood it correctly).
Check it out, feel free to make it workable with the v1.6 release. Or ask me if any help is needed.

from react-checkbox-tree.

jakezatecky avatar jakezatecky commented on May 18, 2024

@worthlutz, yes the partial nodes are intentionally not included in the checked array.

from react-checkbox-tree.

jakezatecky avatar jakezatecky commented on May 18, 2024

@bikashkomprise can you post a live example showing your issue? I created a quick sandbox example that logs to the console all nodes when items are checked/unchecked:

https://codesandbox.io/s/q9kxzq4vz9

from react-checkbox-tree.

radufilipescu avatar radufilipescu commented on May 18, 2024

Hi, any updates on this cool new feature ? :D

from react-checkbox-tree.

koi-annu avatar koi-annu commented on May 18, 2024

How can I do this?

  1. when one child selected then automatically include parent as checked result
  2. add extra component input for example to each node

from react-checkbox-tree.

Mitesh13499 avatar Mitesh13499 commented on May 18, 2024

As asked by @worthlutz,
Would be very useful for me if we get all the grey (half checked) nodes as well when any child is selected in the sub tree.

from react-checkbox-tree.

SaimMohanish avatar SaimMohanish commented on May 18, 2024

Is there any update about half checked nodes

from react-checkbox-tree.

Mitesh13499 avatar Mitesh13499 commented on May 18, 2024

The only thing that helped me to get all the half checked nodes in onCheck was to override the code of the library as per my needs. all in the checkModel prop didn't help.

from react-checkbox-tree.

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.