Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

On click toggle #51

Conversation

goodmorninggoaway
Copy link

Use Case: clicking a toggle icon to view child nodes does not equal selecting that node.
Add onClickIcon to handle this case.

mdavis added 2 commits December 12, 2016 16:11
Use Case: clicking a toggle icon to view child nodes does not equal selecting that node.
Add onClickIcon to handle this case.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 99.492% when pulling 43db623 on goodmorninggoaway:on-click-toggle into 3046fc0 on alexcurtis:master.

goodmorninggoaway pushed a commit to goodmorninggoaway/react-treebeard that referenced this pull request Dec 12, 2016
@witalobenicio
Copy link

How can we use that? I tried to pass an onClickIcon prop to TreeBeard component but it didn't work.

@goodmorninggoaway
Copy link
Author

I didn't update the default decorators to use this. You have to use it in a custom decorator.

Example:

const PoolContainer = ({ onClick, onClickIcon, node }) => {
    const hasChildren = node.children && node.children.length;

    return (
        <div className={cx('node')}>
            <Caret
                onClick={hasChildren ? onClickIcon : null}
                toggled={node.toggled}
                className={cx('caret', { invisible: !hasChildren })}
            />
            <PoolNodeIcon onClick={onClick} />
            <PoolNodeHeader node={node} onClick={onClick} />
        </div>
    );
};

I'm using this in a dropdown, and I want it to auto-close when i select a node, but not when I click the caret to explode the tree node.

@witalobenicio
Copy link

I'm using like this:

<Treebeard
                                                    onClickIcon={this.onClickIcon.bind(this)}
                                                    data={this.state.dataSecondarySubject}
                                                    style={treeStyle}
                                                    onToggle={this.onToggleSecondary.bind(this)}
                                                />

@goodmorninggoaway
Copy link
Author

goodmorninggoaway commented Feb 1, 2017 via email

@a-siewe
Copy link

a-siewe commented Mar 28, 2017

can someone merge this PR?
Please !

@kazazor
Copy link

kazazor commented May 18, 2017

@goodmorninggoaway - why not change the default decorators? This is just adding functionality isn't it? How will it break the existing one?

I would also expect a change in the README file saying you can pass this new prop..

@mpeula-pe
Copy link

can someone merge this PR?
It would be a very nice feature!

@MichaelDeBoey
Copy link
Contributor

@mpeula-pe: @goodmorninggoaway First needs to resolve the conflicts before this one can be merged

@coveralls
Copy link

coveralls commented Sep 19, 2017

Coverage Status

Coverage decreased (-0.9%) to 97.609% when pulling c7cc772 on goodmorninggoaway:on-click-toggle into 438c4f5 on alexcurtis:master.

@coveralls
Copy link

coveralls commented Sep 19, 2017

Coverage Status

Coverage increased (+0.04%) to 98.594% when pulling df4550b on goodmorninggoaway:on-click-toggle into 438c4f5 on alexcurtis:master.

@Lukejkw
Copy link

Lukejkw commented Sep 28, 2017

When will this be merged in and available?

@mwilc0x
Copy link

mwilc0x commented Oct 20, 2017

This looks good to add? I also have a use case in a real world app for this functionality. Cheers!

@coveralls
Copy link

coveralls commented Oct 26, 2017

Coverage Status

Coverage increased (+0.04%) to 98.594% when pulling dce089a on goodmorninggoaway:on-click-toggle into 438c4f5 on alexcurtis:master.

@cdtinney
Copy link

Would love to see this merged in.

@buptlee
Copy link

buptlee commented Sep 19, 2018

When will this be merged in and available?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet