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

Commit

Permalink
#433 Preventing the empty error displaying on pending init
Browse files Browse the repository at this point in the history
  • Loading branch information
damianprzygodzki committed Mar 28, 2017
1 parent 6f61ce9 commit ac1aabe
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/components/table/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ class Table extends Component {
},
promptOpen: false,
isBatchEntry: false,
rows: []
rows: [],
pendingInit: true
}
}

Expand Down Expand Up @@ -95,6 +96,10 @@ class Table extends Component {
getIndentData = (selectFirst) => {
const {rowData, tabid, indentSupported} = this.props;

if(!(rowData[1] && Object.keys(rowData[1]).length)){
return;
}

if(indentSupported){
let rowsData = [];

Expand All @@ -103,7 +108,8 @@ class Table extends Component {
})

this.setState({
rows: rowsData
rows: rowsData,
pendingInit: !!Object.keys(rowsData)
}, () => {
if(selectFirst){
this.selectOneProduct(this.state.rows[0].id);
Expand All @@ -113,7 +119,8 @@ class Table extends Component {
})
} else {
this.setState({
rows: rowData[tabid]
rows: rowData[tabid],
pendingInit: !!Object.keys(rowData[tabid])
});
}
}
Expand Down Expand Up @@ -625,6 +632,11 @@ class Table extends Component {

renderEmptyInfo = (data, tabId) => {
const {emptyText, emptyHint} = this.props;
const {pendingInit} = this.state;

if(pendingInit){
return false;
}

if(
(data && data[tabId] && Object.keys(data[tabId]).length === 0) ||
Expand Down

0 comments on commit ac1aabe

Please sign in to comment.