Skip to content

Commit

Permalink
Revert "Fixed #2030 - OnPage datatable call api twice"
Browse files Browse the repository at this point in the history
This reverts commit d77adc5.
  • Loading branch information
mertsincan committed Jul 16, 2021
1 parent d77adc5 commit e5e864b
Show file tree
Hide file tree
Showing 2 changed files with 741 additions and 138 deletions.
9 changes: 2 additions & 7 deletions src/components/paginator/Paginator.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,21 +142,16 @@ export class Paginator extends Component {
}

onRowsChange(event) {
const rows = event.value;

this.isRowChanged = rows !== this.props.rows;
this.changePage(0, rows);
this.changePage(0, event.value);
}

componentDidUpdate(prevProps, prevState) {
if (this.props.rows !== prevProps.rows && !this.isRowChanged) {
if (this.props.rows !== prevProps.rows) {
this.changePage(0, this.props.rows);
}
else if (this.getPage() > 0 && prevProps.totalRecords !== this.props.totalRecords && this.props.first >= this.props.totalRecords) {
this.changePage((this.getPageCount() - 1) * this.props.rows, this.props.rows);
}

this.isRowChanged = false;
}

renderElement(key, template) {
Expand Down
Loading

0 comments on commit e5e864b

Please sign in to comment.