material-table icon indicating copy to clipboard operation
material-table copied to clipboard

TotalCount of Records for pagination cannot be specified in any props

Open vijthang61 opened this issue 7 years ago • 7 comments

Describe the bug Need to set count for pagination which does pagination from server side. Since I am not able to set the count of total records pagination function is not working as it takes pagesize as the count.

components={{ Pagination: props => ( <TablePagination rowsPerPageOptions={[5, 10, 25]} colSpan={3} count={rows.length} rowsPerPage={rowsPerPage} page={page} SelectProps={{ native: true, }} onChangePage={this.handleChangePage} onChangeRowsPerPage={this.handleChangeRowsPerPage} ActionsComponent={TablePaginationActionsWrapped} /> ), }} onChangeRowsPerPage = {this.handleChangeRowsPerPage} onChangePage = {this.handleChangePage}

The last two lines become waste as I have to provide it as input to the custom pagination component again

Can count alone be set without touching other pros

vijthang61 avatar Jan 30 '19 12:01 vijthang61

This is very urgent, can this be added to any release soon?

vijthang61 avatar Jan 30 '19 17:01 vijthang61

Actually i am very busy with other features and my other projects. So this will take time. Also i am planning to implement fully server side feature that includes paging, filtering, search, sorting and so on.

mbrn avatar Jan 30 '19 17:01 mbrn

for now if this count alone can be given global access, it will be great. Since you will not be able to work on that. Any planned deadlines for finishing serer side feature?

vijthang61 avatar Jan 30 '19 17:01 vijthang61

Actually there is no planned deadline. But it could be in 2 months. Because before server side feature i want o complete minor requirements and refactor code to be stay clean.

mbrn avatar Jan 30 '19 17:01 mbrn

in that case would it be possible to add count in global props for now.

vijthang61 avatar Jan 30 '19 18:01 vijthang61

components={{ Pagination: props => ( <TablePagination {...props} /> ), }}

This is the example give in material for custom pagination component, is there a way to set/update count for the props.

I am new to React js so, could you let me know if there is a way through which I can set the count, can you give some sample code to do this

vijthang61 avatar Jan 30 '19 18:01 vijthang61

  1. Copy this code to your project and rename the component: https://github.com/mbrn/material-table/blob/master/src/m-table-pagination.js
  2. Change what you need.
  3. Override the Pagination component with components property of material-table.

mbrn avatar Jan 30 '19 18:01 mbrn