Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination #1

Open
UmerIftikhar opened this issue Feb 19, 2018 · 3 comments
Open

Pagination #1

UmerIftikhar opened this issue Feb 19, 2018 · 3 comments

Comments

@UmerIftikhar
Copy link

Hi Ben,

Is there a way to add pagination using material ui.
Since, the official docs does not list pagination in the Table documentation.
And is this https://material-ui-next.com/api/table-pagination/ also material ui???
And is it save to use it?

@benawad
Copy link
Owner

benawad commented Feb 19, 2018

I think the link is still in beta, I would wait until it's released to use it. I think it's possible to add pagination

@UmerIftikhar
Copy link
Author

UmerIftikhar commented Feb 20, 2018

Well, I guess its possible to add in the current version as well.
You might have come across this https://github.com/mui-org/material-ui/issues/1511.
mui/material-ui#1511

By adding some thing like this:

`<Table
height={this.state.height}
fixedHeader={this.state.fixedHeader}
fixedFooter={this.state.fixedFooter}
selectable={false}
multiSelectable={false}

<TableHeader displaySelectAll={false} adjustForCheckbox={false}>
  <TableRow>
	{this.tableData ? Object.keys(this.tableData[0]).map((key, idx) => (
	  <TableHeaderColumn>{Utils.toHeaderCase(key)}</TableHeaderColumn>
	))
	  : ''}
  </TableRow>
</TableHeader>
<TableBody
  deselectOnClickaway={this.state.deselectOnClickaway}
  displayRowCheckbox={false}
  showRowHover={this.state.showRowHover}
  stripedRows={this.state.stripedRows}
>
  {this.tableData ? this.tableData.map((row, index) => (
	<TableRow key={index} selected={row.selected}>
	  {Object.keys(row).map((prop, ind) => (
		<TableRowColumn>{row[prop]}</TableRowColumn>
	  ))
	  }
	</TableRow>
  )) : ''}
</TableBody>
<TableFooter>
  <TableRow>
	<TableRowColumn style={styles.footerContent}>
	  <IconButton onClick={() => this.getPreviousPage()} disabled={!(this.props.pagination.hasOwnProperty('prev'))}>
		<ChevronLeft/>
	  </IconButton>
	  <IconButton onClick={() => this.getNextPage()} disabled={!(this.props.pagination.hasOwnProperty('next'))}>
		<ChevronRight/>
	  </IconButton>
	</TableRowColumn>
	<TableRowColumn style={styles.footerText} />
  </TableRow>
</TableFooter>
`

@benawad
Copy link
Owner

benawad commented Feb 20, 2018

yeah

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants