Ver Fonte

add pagination

zahmis há 5 anos atrás
pai
commit
f8a5098dc8
1 ficheiros alterados com 14 adições e 0 exclusões
  1. 14 0
      src/client/js/components/PageAttachment.jsx

+ 14 - 0
src/client/js/components/PageAttachment.jsx

@@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
 
 import PageAttachmentList from './PageAttachment/PageAttachmentList';
 import DeleteAttachmentModal from './PageAttachment/DeleteAttachmentModal';
+import PaginationWrapper from './PaginationWrapper';
 import { withUnstatedContainers } from './UnstatedUtils';
 import AppContainer from '../services/AppContainer';
 import PageContainer from '../services/PageContainer';
@@ -13,12 +14,18 @@ class PageAttachment extends React.Component {
   constructor(props) {
     super(props);
 
+    const { appContainer } = this.props;
+    this.handlePage = this.handlePage.bind(this);
+
     this.state = {
       attachments: [],
       inUse: {},
       attachmentToDelete: null,
       deleting: false,
       deleteError: '',
+      activePage: 1,
+      totalPage: 0,
+      limit: appContainer.getConfig(),
     };
 
     this.onAttachmentDeleteClicked = this.onAttachmentDeleteClicked.bind(this);
@@ -132,6 +139,13 @@ class PageAttachment extends React.Component {
         />
 
         {deleteAttachmentModal}
+
+        <PaginationWrapper
+          activePage={this.state.activePage}
+          changePage={this.handlePage}
+          totalItemCount={this.state.totalPage}
+          pagingLimit={this.state.limit}
+        />
       </div>
     );
   }