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

On row context menu #301

Merged
merged 5 commits into from
Mar 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/FixedDataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,11 @@ var FixedDataTable = createReactClass({
*/
onRowDoubleClick: PropTypes.func,

/**
* Callback that is called when a contextual-menu event happens on a row.
*/
onRowContextMenu: PropTypes.func,

/**
* Callback that is called when a mouse-down event happens on a row.
*/
Expand Down Expand Up @@ -834,6 +839,7 @@ var FixedDataTable = createReactClass({
offsetTop={offsetTop}
onRowClick={state.onRowClick}
onRowDoubleClick={state.onRowDoubleClick}
onRowContextMenu={state.onRowContextMenu}
onRowMouseDown={state.onRowMouseDown}
onRowMouseUp={state.onRowMouseUp}
onRowMouseEnter={state.onRowMouseEnter}
Expand Down
2 changes: 2 additions & 0 deletions src/FixedDataTableBufferedRows.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ var FixedDataTableBufferedRows = createReactClass({
offsetTop: PropTypes.number.isRequired,
onRowClick: PropTypes.func,
onRowDoubleClick: PropTypes.func,
onRowContextMenu: PropTypes.func,
onRowMouseDown: PropTypes.func,
onRowMouseUp: PropTypes.func,
onRowMouseEnter: PropTypes.func,
Expand Down Expand Up @@ -175,6 +176,7 @@ var FixedDataTableBufferedRows = createReactClass({
scrollableColumns={props.scrollableColumns}
onClick={props.onRowClick}
onDoubleClick={props.onRowDoubleClick}
onContextMenu={props.onRowContextMenu}
onMouseDown={props.onRowMouseDown}
onMouseUp={props.onRowMouseUp}
onMouseEnter={props.onRowMouseEnter}
Expand Down
10 changes: 10 additions & 0 deletions src/FixedDataTableRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ class FixedDataTableRowImpl extends React.Component {
*/
onDoubleClick: PropTypes.func,

/**
* Fire when a contextual-menu is requested above a row.
*/
onContextMenu: PropTypes.func,

/**
* Callback for when resizer knob (in FixedDataTableCell) is clicked
* to initialize resizing. Please note this is only on the cells
Expand Down Expand Up @@ -252,6 +257,7 @@ class FixedDataTableRowImpl extends React.Component {
className={joinClasses(className, this.props.className)}
onClick={this.props.onClick ? this._onClick : null}
onDoubleClick={this.props.onDoubleClick ? this._onDoubleClick : null}
onContextMenu={this.props.onContextMenu ? this._onContextMenu : null}
onMouseDown={this.props.onMouseDown ? this._onMouseDown : null}
onMouseUp={this.props.onMouseUp ? this._onMouseUp : null}
onMouseEnter={this.props.onMouseEnter || this.props.onMouseLeave ? this._onMouseEnter : null}
Expand Down Expand Up @@ -360,6 +366,10 @@ class FixedDataTableRowImpl extends React.Component {
this.props.onDoubleClick(event, this.props.index);
};

_onContextMenu = (/*object*/ event) => {
this.props.onContextMenu(event, this.props.index)
};

_onMouseUp = (/*object*/ event) => {
this.props.onMouseUp(event, this.props.index);
};
Expand Down