From 87a368858cf667651adc67b06316fa8d98b796f6 Mon Sep 17 00:00:00 2001 From: sunilyadav840 Date: Tue, 10 Aug 2021 16:21:13 +0530 Subject: [PATCH] Add pagination view and fixed scroll issue --- less/TableStyles/queryBuilder.less | 23 +++++++++ .../QueryTablesTab/QueryTableTabUtils.tsx | 1 + .../QueryTablesTabComponent.tsx | 51 ++++++++++++++----- 3 files changed, 62 insertions(+), 13 deletions(-) diff --git a/less/TableStyles/queryBuilder.less b/less/TableStyles/queryBuilder.less index 90553e7b9..310f9e947 100644 --- a/less/TableStyles/queryBuilder.less +++ b/less/TableStyles/queryBuilder.less @@ -534,6 +534,29 @@ input::-webkit-inner-spin-button { margin-bottom: 5px; } +.query-document-detail-list { + max-height: 180px; + overflow-x: hidden; +} +.query-table-clause-container { + max-height: 80px; + overflow: scroll; + overflow-x: hidden; +} +.query-tab-document-pagination { + margin-top: 18px; +} +.pagination > li > div { + position: relative; + float: left; + padding: 6px 12px; + margin-left: -1px; + line-height: 1.42857143; + text-decoration: none; + background-color: #fff; + border: 1px solid #ddd; + cursor: pointer; +} /* @media only screen and (max-width: 1200px) { .clause-table { diff --git a/src/Explorer/Tabs/QueryTablesTab/QueryTableTabUtils.tsx b/src/Explorer/Tabs/QueryTablesTab/QueryTableTabUtils.tsx index 39c13f556..5b6ea452a 100644 --- a/src/Explorer/Tabs/QueryTablesTab/QueryTableTabUtils.tsx +++ b/src/Explorer/Tabs/QueryTablesTab/QueryTableTabUtils.tsx @@ -66,6 +66,7 @@ export interface IQueryTablesTabComponentStates { isLoading: boolean; queryErrorMessage: string; hasQueryError: boolean; + currentPage: number; } export interface IQueryTableRowsType { diff --git a/src/Explorer/Tabs/QueryTablesTab/QueryTablesTabComponent.tsx b/src/Explorer/Tabs/QueryTablesTab/QueryTablesTabComponent.tsx index 913100838..bfb293d0a 100644 --- a/src/Explorer/Tabs/QueryTablesTab/QueryTablesTabComponent.tsx +++ b/src/Explorer/Tabs/QueryTablesTab/QueryTablesTabComponent.tsx @@ -62,6 +62,8 @@ export interface Button { isSelected?: boolean; } +const dummyQueryDocumentsPages = [1, 2, 3]; + class QueryTablesTabComponent extends Component { public collection: ViewModels.Collection; public _queryViewModel: QueryViewModel; @@ -189,6 +191,7 @@ class QueryTablesTabComponent extends Component { + // eslint-disable-next-line no-console + console.log("pagination", pageNo); + this.setState({ currentPage: pageNo }); + }; + render(): JSX.Element { useCommandBar.getState().setContextButtons(this.getTabsButtons()); - const { queryTableRows } = this.state; + const { queryTableRows, currentPage } = this.state; return (
@@ -791,7 +800,7 @@ class QueryTablesTabComponent extends Component
- <> +
{queryTableRows.map((queryTableRow, index) => ( ))} - +
@@ -910,16 +919,32 @@ class QueryTablesTabComponent extends Component {this.state.isLoading && } {this.state.items.length > 0 && !this.state.isLoading && ( - + <> + +
    +
  • +
    this.handlePagination(currentPage - 1)}>Previous
    +
  • + {dummyQueryDocumentsPages.map((pageNo) => ( +
  • this.handlePagination(pageNo)}> +
    {pageNo}
    +
  • + ))} +
  • +
    this.handlePagination(currentPage + 1)}>Next
    +
  • +
+ )} {this.state.items.length === 0 && !this.state.isLoading && ( No data available in table