Skip to content

Commit

Permalink
Fix cell order in DOM (#630) (Fixes #221)
Browse files Browse the repository at this point in the history
Order cells in the DOM by row-major order.
We use aria row index for the sort criteria.
  • Loading branch information
pradeepnschrodinger authored May 31, 2022
1 parent 6efc3c6 commit fda8784
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/FixedDataTableBufferedRows.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,13 @@ class FixedDataTableBufferedRows extends React.Component {
// We translate all the rows together with a parent div. This saves a lot of renders.
const style = {};
FixedDataTableTranslateDOMPosition(style, 0, containerOffsetTop, false);
return <div style={style}>{this._staticRowArray}</div>;

// NOTE (pradeep): Sort the rows by row index so that they appear with the right order in the DOM (see #221)
const sortedRows = _.sortBy(this._staticRowArray, (row) =>
_.get(row, 'props.ariaRowIndex', Infinity)
);

return <div style={style}>{sortedRows}</div>;
}

/**
Expand Down

0 comments on commit fda8784

Please sign in to comment.