Skip to content

Commit

Permalink
Merge pull request mbrn#2296 from sujay-gandham-by/fix/filter-alignme…
Browse files Browse the repository at this point in the history
…nt-details-panel

Filter row misaligns when details panel column is to the right.
  • Loading branch information
mbrn authored Aug 16, 2020
2 parents 78fb50e + 355f721 commit 490d95b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/components/m-table-body.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ class MTableBody extends React.Component {
.dateTimePickerLocalization,
}}
hasDetailPanel={!!this.props.detailPanel}
detailPanelColumnAlignment={
this.props.options.detailPanelColumnAlignment
}
isTreeData={this.props.isTreeData}
filterCellStyle={this.props.options.filterCellStyle}
filterRowStyle={this.props.options.filterRowStyle}
Expand Down
6 changes: 5 additions & 1 deletion src/components/m-table-filter-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,10 @@ class MTableFilterRow extends React.Component {
}

if (this.props.hasDetailPanel) {
const alignment = this.props.detailPanelColumnAlignment;
const index = alignment === "left" ? 0 : columns.length;
columns.splice(
0,
index,
0,
<TableCell padding="none" key="key-detail-panel-column" />
);
Expand Down Expand Up @@ -284,6 +286,7 @@ class MTableFilterRow extends React.Component {

MTableFilterRow.defaultProps = {
columns: [],
detailPanelColumnAlignment: "left",
selection: false,
hasActions: false,
localization: {
Expand All @@ -295,6 +298,7 @@ MTableFilterRow.defaultProps = {
MTableFilterRow.propTypes = {
columns: PropTypes.array.isRequired,
hasDetailPanel: PropTypes.bool.isRequired,
detailPanelColumnAlignment: PropTypes.string,
isTreeData: PropTypes.bool.isRequired,
onFilterChanged: PropTypes.func.isRequired,
filterCellStyle: PropTypes.object,
Expand Down

0 comments on commit 490d95b

Please sign in to comment.