Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
Directly display quick actions for the first row of a modal window #1030
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunkat committed Jul 17, 2017
1 parent c74d7a1 commit 0cd43d3
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions src/components/table/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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 }
}
Expand Down Expand Up @@ -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(
Expand All @@ -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
Expand Down

0 comments on commit 0cd43d3

Please sign in to comment.