diff --git a/src/components/table/Table.js b/src/components/table/Table.js index 7657a006e..6559ed944 100644 --- a/src/components/table/Table.js +++ b/src/components/table/Table.js @@ -69,13 +69,20 @@ class Table extends Component { componentDidUpdate(prevProps, prevState) { const { mainTable, open, rowData, defaultSelected, disconnectFromState, - dispatch, type, refreshSelection + dispatch, type, refreshSelection, supportIncludedViewOnSelect, + showIncludedViewOnSelect } = this.props; const { - selected + selected, rows } = this.state; + if((JSON.stringify(prevState.rows) !== + JSON.stringify(rows))){ + this.showSelectedIncludedView(selected); + } + + if(mainTable && open){ this.table.focus(); } @@ -107,6 +114,16 @@ class Table extends Component { } } + showSelectedIncludedView = (selected) => { + const {showIncludedViewOnSelect, supportIncludedViewOnSelect} = this.props; + const {rows} = this.state; + selected.length === 1 && supportIncludedViewOnSelect && rows.map(item=>{ + if(item.id === selected[0]){ + showIncludedViewOnSelect(item.supportIncludedViews, item.includedView) + } + }); + } + getChildContext = () => { return { shortcuts: shortcutManager } } @@ -332,7 +349,8 @@ class Table extends Component { if(!selectRange) { this.selectOneProduct( - array[currentId + 1], false, idFocused + array[currentId + 1], false, idFocused, + this.showSelectedIncludedView([array[currentId + 1]]) ); } else { this.selectProduct( @@ -357,8 +375,10 @@ class Table extends Component { if(!selectRange) { this.selectOneProduct( - array[currentId - 1], idFocused, false + array[currentId - 1], idFocused, false, + this.showSelectedIncludedView([array[currentId - 1]]) ); + } else { this.selectProduct( array[currentId - 1], idFocused, false