Skip to content

Commit cd670cb

Browse files
SirGandalwcjordan
authored andcommitted
Adding onRowTouchStart, onRowTouchEnd and onRowTouchMove callbacks on Table (schrodinger#238)
* Adding onRowTouchStart, onRowTouchEnd and onRowTouchMove callbacks on Table.
1 parent 410c64b commit cd670cb

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

src/FixedDataTable.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,21 @@ var FixedDataTable = createReactClass({
321321
*/
322322
onRowMouseLeave: PropTypes.func,
323323

324+
/**
325+
* Callback that is called when a touch-start event happens on a row.
326+
*/
327+
onRowTouchStart: PropTypes.func,
328+
329+
/**
330+
* Callback that is called when a touch-end event happens on a row.
331+
*/
332+
onRowTouchEnd: PropTypes.func,
333+
334+
/**
335+
* Callback that is called when a touch-move event happens on a row.
336+
*/
337+
onRowTouchMove: PropTypes.func,
338+
324339
/**
325340
* Callback that is called when resizer has been released
326341
* and column needs to be updated.
@@ -732,6 +747,9 @@ var FixedDataTable = createReactClass({
732747
onRowMouseUp={state.onRowMouseUp}
733748
onRowMouseEnter={state.onRowMouseEnter}
734749
onRowMouseLeave={state.onRowMouseLeave}
750+
onRowTouchStart={state.touchScrollEnabled ? state.onRowTouchStart : null}
751+
onRowTouchEnd={state.touchScrollEnabled ? state.onRowTouchEnd : null}
752+
onRowTouchMove={state.touchScrollEnabled ? state.onRowTouchMove : null}
735753
rowClassNameGetter={state.rowClassNameGetter}
736754
rowsCount={state.rowsCount}
737755
rowGetter={state.rowGetter}

src/FixedDataTableBufferedRows.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ var FixedDataTableBufferedRows = createReactClass({
3838
onRowMouseUp: PropTypes.func,
3939
onRowMouseEnter: PropTypes.func,
4040
onRowMouseLeave: PropTypes.func,
41+
onRowTouchStart: PropTypes.func,
42+
onRowTouchEnd: PropTypes.func,
43+
onRowTouchMove: PropTypes.func,
4144
rowClassNameGetter: PropTypes.func,
4245
rowsCount: PropTypes.number.isRequired,
4346
rowHeightGetter: PropTypes.func,
@@ -174,6 +177,9 @@ var FixedDataTableBufferedRows = createReactClass({
174177
onMouseUp={props.onRowMouseUp}
175178
onMouseEnter={props.onRowMouseEnter}
176179
onMouseLeave={props.onRowMouseLeave}
180+
onTouchStart={props.onRowTouchStart}
181+
onTouchEnd={props.onRowTouchEnd}
182+
onTouchMove={props.onRowTouchMove}
177183
className={joinClasses(
178184
rowClassNameGetter(rowIndex),
179185
cx('public/fixedDataTable/bodyRow'),

src/FixedDataTableRow.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ class FixedDataTableRowImpl extends React.Component {
191191
onMouseUp={this.props.onMouseUp ? this._onMouseUp : null}
192192
onMouseEnter={this.props.onMouseEnter ? this._onMouseEnter : null}
193193
onMouseLeave={this.props.onMouseLeave ? this._onMouseLeave : null}
194+
onTouchStart={this.props.onTouchStart ? this._onTouchStart : null}
195+
onTouchEnd={this.props.onTouchEnd ? this._onTouchEnd : null}
196+
onTouchMove={this.props.onTouchMove ? this._onTouchMove : null}
194197
style={style}>
195198
<div className={cx('fixedDataTableRowLayout/body')}>
196199
{fixedColumns}
@@ -286,6 +289,18 @@ class FixedDataTableRowImpl extends React.Component {
286289
_onMouseLeave = (/*object*/ event) => {
287290
this.props.onMouseLeave(event, this.props.index);
288291
};
292+
293+
_onTouchStart = (/*object*/ event) => {
294+
this.props.onTouchStart(event, this.props.index);
295+
};
296+
297+
_onTouchEnd = (/*object*/ event) => {
298+
this.props.onTouchEnd(event, this.props.index);
299+
};
300+
301+
_onTouchMove = (/*object*/ event) => {
302+
this.props.onTouchMove(event, this.props.index);
303+
};
289304
}
290305

291306
class FixedDataTableRow extends React.Component {

0 commit comments

Comments
 (0)