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

Commit

Permalink
Merge pull request #457 from metasfresh/dev-297
Browse files Browse the repository at this point in the history
Dev 297
  • Loading branch information
damianprzygodzki committed Mar 1, 2017
2 parents fdbb71e + 4ef737c commit 8f5da3a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/components/app/DocumentList.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class DocumentList extends Component {
componentWillReceiveProps(props) {
const {
windowType, defaultViewId, defaultSort, defaultPage, selected,
inBackground
inBackground, dispatch
} = props;
const {page, sort, viewId, cachedSelection} = this.state;

Expand All @@ -68,7 +68,7 @@ class DocumentList extends Component {
filters: null,
viewId: null
}, () => {

dispatch(selectTableItems([]))
this.fetchLayoutAndData();
});
}
Expand Down Expand Up @@ -112,9 +112,7 @@ class DocumentList extends Component {
inBackground != this.props.inBackground
) {
if(!inBackground){
this.props.dispatch(
selectTableItems(cachedSelection)
)
dispatch(selectTableItems(cachedSelection))
}else{
this.setState({
cachedSelection: selected
Expand Down
11 changes: 10 additions & 1 deletion src/components/table/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Table extends Component {
}

componentDidUpdate(prevProps) {
const {mainTable, open, rowData} = this.props;
const {mainTable, open, rowData, defaultSelected} = this.props;

if(mainTable && open){
this.table.focus();
Expand All @@ -75,6 +75,15 @@ class Table extends Component {
){
this.getIndentData();
}

if(
JSON.stringify(prevProps.defaultSelected) !==
JSON.stringify(defaultSelected)
){
this.setState({
selected: defaultSelected
})
}
}

getChildContext = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/containers/MasterWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class MasterWindow extends Component {
render() {
const {
master, modal, breadcrumb, references, actions, attachments,
rawModal, selected, indicator, dispatch
rawModal, selected, indicator
} = this.props;

const {newRow, modalTitle} = this.state;
Expand Down

0 comments on commit 8f5da3a

Please sign in to comment.