Skip to content

Add ability to have a context menu handler on the datasheet#13

Merged
nadbm merged 3 commits intonadbm:masterfrom
weswigham:master
Apr 11, 2017
Merged

Add ability to have a context menu handler on the datasheet#13
nadbm merged 3 commits intonadbm:masterfrom
weswigham:master

Conversation

@weswigham
Copy link
Contributor

Which is triggered for each cell uniquely.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.2%) to 98.131% when pulling 241bb58 on weswigham:master into 6e2e65d on nadbm:master.

@nadbm
Copy link
Owner

nadbm commented Apr 6, 2017

@weswigham This is great! Did you have an example usage? Would love to put it on the examples as well :)

@weswigham
Copy link
Contributor Author

Just something like

        <ReactDatasheet
            data={fixedData}
            valueRenderer={cell => cell.value}
            onChange={props.onChange}
            onContextMenu={(event, cell, i, j) => {
              toggleRightClickedCell(i, j);
              event.preventDefault();
            }}
        />

In my case, I wanted to disable the default right-click menu and toggle the read-onlyness of a cell on right-click.

@nadbm
Copy link
Owner

nadbm commented Apr 7, 2017

@weswigham Are you ever doing anything with the evt object other than preventDefault?
I would like to keep the api a little consistent so might want change that.

@weswigham
Copy link
Contributor Author

weswigham commented Apr 7, 2017 via email

@nadbm nadbm merged commit 7fc4458 into nadbm:master Apr 11, 2017
@kamaldlk
Copy link

@weswigham do you have any examples for context menu

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants