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

Allows checkbox for tree nodes #79

Closed
kennywk opened this issue Apr 16, 2017 · 15 comments
Closed

Allows checkbox for tree nodes #79

kennywk opened this issue Apr 16, 2017 · 15 comments

Comments

@kennywk
Copy link

kennywk commented Apr 16, 2017

Would be nice if there was a standard way of putting checkboxes and checked events within the tree model.

@sovan107
Copy link

Just looking for something like this. [+1 for request]

@TKul6
Copy link

TKul6 commented Sep 10, 2017

@rychkog If you want, I'll be happy to start browsing the source code and check how to do that.

This feature will be helpful for me as well.

@rychkog
Copy link
Contributor

rychkog commented Sep 11, 2017

@Tmaster sure, go ahead! I don't have enough time for adding new stuff these days. If you'll have any questions - feel free to ask.

@TKul6
Copy link

TKul6 commented Sep 26, 2017

Hi,

I started working on the checkbox feature, this is what I have so far:

  • In the Ng2TreeSettings contains another parameter enableCheckboxes which is false by default. switching this flag to true will show a checkbox next to any node.
  • The tree components exposes additional 2 EventEmitters: nodeChecked and nodeUnchecked, when checking \ unchecking node the relevant events are emitted with the node data.
  • The TreeController support checking \ unchecking the node.

@rychkog I had to pass the settings object to every node in order to pass the enableCheckboxes property. What do you think about that? is there risks in doing that?
Change is here

All the changes are here
I added to the demo additional buttons to check \ uncheck nodes.

The next thing I want to do is to support father-child relations, and for that I need your opinion on how to develop that:

Let's take the Fonts tree in the demo for example.

  1. If the user checks a branch (Slab serif for example), all his descendants will be also checked (and relevant events will be emitted for each node).
  2. If a user unchecked a font inside this branch the Slab serif node's state will be undetermined (not sure if event should be emitted in that case, and if so what type). In addition all the ancestors of Slab serif will also be in undetermined state.
  3. if the Slab serif node will be unchecked all his descendants will be automatically unchecked (and relevant events will be emitted for each node).

What do you think?

Thanks,
TMaster

@rychkog
Copy link
Contributor

rychkog commented Oct 7, 2017

@Tmaster Just do a PR - it will be easier for us to work on this feature. According to undetermined state - we can have 3 types of state for a tree with checkboxes - CHECKED, UNCHECKED, UNDETERMINED. That's it. Events should be emitted in a way you described + undetermined event for Parents with partially checked children.

@rychkog
Copy link
Contributor

rychkog commented Oct 7, 2017

@Tmaster PRs will allow us to bring this feature to the master much faster

@omid-nazifi
Copy link

omid-nazifi commented Jan 9, 2018

@rychkog @Tmaster Could you tell me that this feature has brought to the master or not? I installed the latest version of ng2tree but i didn't access it.

@AllNamesRTaken
Copy link

This is exactly what we are looking for. What is the status?
Help Needed?

@TKul6
Copy link

TKul6 commented Jan 24, 2018

There is a pending PR #181
I'm waiting for @rychkog to replay for a designing problem there.

@boban100janovski
Copy link

Any progress on this?

@rychkog
Copy link
Contributor

rychkog commented Feb 1, 2018

@Tmaster @boban984 I'm back - had a massive amount of work and no chance to work on the tree. Sorry about that. Will start gradually working on issues and resolving checkboxes feature is the first thing I'll do.

@rychkog rychkog closed this as completed Feb 1, 2018
@rychkog rychkog reopened this Feb 1, 2018
@boban100janovski
Copy link

boban100janovski commented Feb 8, 2018

@rychkog do you have an estimate of when you will be able to merge the pull request for the "Checkbox" feature? Or maybe it's better to fork the repo and add it?

Maybe i can help out somehow?

@rychkog
Copy link
Contributor

rychkog commented Feb 8, 2018

@boban984 There are some comments that need to be fixed - once done - will be merged

@rychkog
Copy link
Contributor

rychkog commented Feb 8, 2018

@boban984 I will be working on issues created so far (including checkboxes) on Saturday

@rychkog
Copy link
Contributor

rychkog commented Feb 8, 2018

Will start with this feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants