Skip to content

Commit

Permalink
SS-15247: Adding resizable row support
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamran Asif committed Apr 8, 2016
1 parent 9858fba commit ac404ef
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/FixedDataTable.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ var FixedDataTable = React.createClass({

var firstRowIndex = (oldState && oldState.firstRowIndex) || 0;
var firstRowOffset = (oldState && oldState.firstRowOffset) || 0;
var scrollX, scrollY;
var scrollX, scrollY, scrollState;

scrollX = oldState ? oldState.scrollX : 0;
if (props.scrollLeft !== this.props.scrollLeft) {
Expand All @@ -774,19 +774,9 @@ var FixedDataTable = React.createClass({
firstRowOffset = scrollState.offset;
scrollY = scrollState.position;
}

if (this._rowToScrollTo !== undefined) {
scrollState =
this._scrollHelper.scrollRowIntoView(this._rowToScrollTo);
firstRowIndex = scrollState.index;
firstRowOffset = scrollState.offset;
scrollY = scrollState.position;
delete this._rowToScrollTo;
}

var groupHeaderHeight = useGroupHeader ? props.groupHeaderHeight : 0;

if (oldState && props.rowsCount !== oldState.rowsCount) {
if (oldState && (props.rowsCount !== oldState.rowsCount || props.rowHeight !== oldState.rowHeight)) {
// Number of rows changed, try to scroll to the row from before the
// change
var viewportHeight =
Expand All @@ -800,7 +790,7 @@ var FixedDataTable = React.createClass({
viewportHeight,
props.rowHeightGetter
);
var scrollState =
scrollState =
this._scrollHelper.scrollToRow(firstRowIndex, firstRowOffset);
firstRowIndex = scrollState.index;
firstRowOffset = scrollState.offset;
Expand All @@ -809,6 +799,15 @@ var FixedDataTable = React.createClass({
this._scrollHelper.setRowHeightGetter(props.rowHeightGetter);
}

if (this._rowToScrollTo !== undefined) {
scrollState =
this._scrollHelper.scrollRowIntoView(this._rowToScrollTo);
firstRowIndex = scrollState.index;
firstRowOffset = scrollState.offset;
scrollY = scrollState.position;
delete this._rowToScrollTo;
}

var columnResizingData;
if (props.isColumnResizing) {
columnResizingData = oldState && oldState.columnResizingData;
Expand Down

0 comments on commit ac404ef

Please sign in to comment.