Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
c37a604
Add FA icons for previous/next/first/last page nav buttons.
Sep 20, 2019
1243c73
Add functions to go to first/last page, and function to return last p…
Sep 20, 2019
b723e8d
Incorporate loadFirst, loadLast, and lastPage into ControlledTable.
Sep 20, 2019
4a1931c
Add new navigation buttons with FA icons and wrap buttons in a contai…
Sep 20, 2019
f61e94a
Add styling for buttons.
Sep 20, 2019
3469aa3
Issue 460 - datestartswith relational operator behavior on number exp…
Marc-Andre-Rivet Sep 18, 2019
187f652
Issue 591 - Row and column selection with multiple tables (#594)
Marc-Andre-Rivet Sep 19, 2019
e941cd1
Issue 546 - Visible columns and data misalignment in export (#592)
Marc-Andre-Rivet Sep 20, 2019
91a0fcd
Merge branch 'dev' into page-numbers-pagination
Sep 20, 2019
9608dfa
Don't display pagination menu if there is only one page.
Sep 20, 2019
c6aa878
Use max_page_count for backend pagination.
Sep 20, 2019
5cf474d
Allow for direct navigation to page.
Sep 25, 2019
37f39e2
Allow for cases in which max_page_count is none/null.
Sep 25, 2019
2720f2b
Issue 539 - Booleans not showing (#593)
dmt0 Sep 23, 2019
1ed49f2
Issue 598 - Permissive value in filter (#599)
Marc-Andre-Rivet Sep 24, 2019
ee35fb4
Fix incorrect cell validation / coercion
Marc-Andre-Rivet Sep 24, 2019
a25a3b1
Delete .prettierrc
Marc-Andre-Rivet Sep 25, 2019
2bf4d41
Adjust for zero-indexing and handle negative max page counts.
Sep 25, 2019
404bf5e
Merge branch 'dev' into page-numbers-pagination
Sep 25, 2019
f049281
Fix typo in docstring.
Sep 25, 2019
036c98f
Add tests for page navigation buttons.
Sep 25, 2019
f1d90da
Add tests to package.json.
Sep 25, 2019
41dd12b
Update src/dash-table/components/Table/props.ts
Sep 26, 2019
b63f1f6
Change max_page_count to page_count/cast input value to number.
Sep 27, 2019
0286be6
Move page navigation to separate component.
Sep 27, 2019
f05af8b
Update max_page_count to page_count in tests.
Sep 27, 2019
4843c19
Remove artifacts from `dev` (#603)
Marc-Andre-Rivet Sep 26, 2019
e2fe777
add back async~dash-table
Sep 26, 2019
44a6619
undo dev commit..
Sep 26, 2019
4062fe0
Delete __init__.py
Marc-Andre-Rivet Sep 26, 2019
3891aa5
Fix eslint errors.
Sep 27, 2019
6dfa09a
Make goToPage logic shorter.
Sep 27, 2019
2787cc9
Move button disable logic to paginator.
Sep 27, 2019
6ee6256
Add underline to input box.
Sep 27, 2019
449efea
Improve test for no page_count defined.
Sep 27, 2019
a3e6bf0
Fix error.
Sep 27, 2019
ff95d7f
Update src/dash-table/dash/DataTable.js
Oct 1, 2019
5828ff3
Update src/dash-table/components/PageNavigation/index.tsx
Oct 1, 2019
398fe88
Add new wrapper class around table and pagination menu.
Oct 1, 2019
2cd3384
Change paginator function names.
Oct 1, 2019
81323ef
Allow for submit on enter.
Oct 1, 2019
5c5b714
Add test for submitting page number with enter key.
Oct 1, 2019
0ad5ab8
Move loadFirst, loadPrevious, and hasPrevious out of FE/BE.
Oct 1, 2019
4696a87
Refactor paginator code.
Oct 3, 2019
9c163ce
Merge branch 'dev' into page-numbers-pagination
Oct 3, 2019
e207d93
Merge branch 'dev' into page-numbers-pagination
Marc-Andre-Rivet Oct 4, 2019
cccf613
Add CHANGELOG entries.
Oct 4, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,22 @@ This project adheres to [Semantic Versioning](http://semver.org/).
[#597](https://github.com/plotly/dash-table/issues/597)
- Add `is blank` unary operator. Returns true for `undefined`, `null` and `''`.

[#299](https://github.com/plotly/dash-table/issues/299)
- New prop `page_count` that sets the maximum number of pages that are
accessible via the pagination menu when using backend pagination.

### Changed
[#598](https://github.com/plotly/dash-table/issues/598)
- Allow values with whitespaces in column filters

[#580](https://github.com/plotly/dash-table/issues/580)
- Change pagination menu button UI to use arrow icons instead of plain
buttons
- Move pagination menu to bottom-right of table
- Include go-to-first and go-to-last buttons
- Include current-page and total-pages display in pagination menu
- Include input box for user to navigate directly to a page

### Fixed
[#460](https://github.com/plotly/dash-table/issues/460)
- The `datestartswith` relational operator now supports number comparison
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"private::host_dash8083": "python tests/cypress/dash/v_fe_page.py",
"private::host_dash8084": "python tests/cypress/dash/v_data_loading.py",
"private::host_dash8085": "python tests/cypress/dash/v_default.py",
"private::host_dash8086": "python tests/cypress/dash/v_pagination.py",
"private::host_js": "http-server ./dash_table -c-1 --silent",
"private::lint:ts": "tslint --project tsconfig.json --config tslint.json",
"private::lint:py": "flake8 --exclude=DataTable.py,__init__.py,_imports_.py dash_table",
Expand All @@ -35,6 +36,7 @@
"private::wait_dash8083": "wait-on http://localhost:8083",
"private::wait_dash8084": "wait-on http://localhost:8084",
"private::wait_dash8085": "wait-on http://localhost:8085",
"private::wait_dash8086": "wait-on http://localhost:8086",
"private::wait_js": "wait-on http://localhost:8080",
"private::opentests": "cypress open",
"private::test.python": "python -m unittest tests/unit/format_test.py",
Expand Down
25 changes: 8 additions & 17 deletions src/dash-table/components/ControlledTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ import queryLexicon from 'dash-table/syntax-tree/lexicon/query';
import dataLoading from 'dash-table/derived/table/data_loading';
import reconcile from 'dash-table/type/reconcile';

import PageNavigation from 'dash-table/components/PageNavigation';

const DEFAULT_STYLE = {
width: '100%'
};
Expand Down Expand Up @@ -629,18 +631,6 @@ export default class ControlledTable extends PureComponent<ControlledTableProps>
) || page_action === TableAction.Custom;
}

loadNext = () => {
const { paginator } = this.props;

paginator.loadNext();
}

loadPrevious = () => {
const { paginator } = this.props;

paginator.loadPrevious();
}

applyStyle = () => {
const {
fixed_columns,
Expand Down Expand Up @@ -807,7 +797,7 @@ export default class ControlledTable extends PureComponent<ControlledTableProps>
tooltip_duration
);

const { export_columns, export_format, export_headers, virtual, merge_duplicate_headers } = this.props;
const { export_columns, export_format, export_headers, virtual, merge_duplicate_headers, paginator, page_current, page_count } = this.props;
const buttonProps = {
export_columns,
export_format,
Expand All @@ -820,6 +810,7 @@ export default class ControlledTable extends PureComponent<ControlledTableProps>

return (<div
id={id}
className='dash-table-container'
onCopy={this.onCopy}
onKeyDown={this.handleKeyDown}
onPaste={this.onPaste}
Expand Down Expand Up @@ -859,10 +850,10 @@ export default class ControlledTable extends PureComponent<ControlledTableProps>
</div>
</div>
{!this.displayPagination ? null : (
<div>
<button className='previous-page' onClick={this.loadPrevious}>Previous</button>
<button className='next-page' onClick={this.loadNext}>Next</button>
</div>
<PageNavigation
paginator={paginator}
page_current={page_current}
page_count={page_count} />
)}
</div>);
}
Expand Down
80 changes: 80 additions & 0 deletions src/dash-table/components/PageNavigation/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import React, { Component } from 'react';
import { IPageNavigationProps } from 'dash-table/components/PageNavigation/props';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { KEY_CODES } from 'dash-table/utils/unicode';

export default class PageNavigation extends Component<IPageNavigationProps> {

constructor(props: IPageNavigationProps) {
super(props);
}

goToPage = (page_number: string) => {
const { paginator } = this.props;

let page = parseInt(page_number, 10);

if (isNaN(page)) {
return;
}

paginator.loadPage(page - 1);
}

render() {
const {
paginator,
page_current
} = this.props;

return (paginator.lastPage !== undefined && paginator.lastPage <= 0) ? null : (
<div className='previous-next-container'>
<button
className='first-page'
onClick={paginator.loadFirst}
disabled={!paginator.hasPrevious()}>
<FontAwesomeIcon icon='angle-double-left' />
</button>

<button
className='previous-page'
onClick={paginator.loadPrevious}
disabled={!paginator.hasPrevious()}>
<FontAwesomeIcon icon='angle-left' />
</button>

<div className='page-number'>
<input
type='text'
className='current-page'
onBlur={event => { this.goToPage(event.target.value); event.target.value = ''; }}
onKeyDown={event => { if (event.keyCode === KEY_CODES.ENTER) { event.currentTarget.blur(); } }}
placeholder={(page_current + 1).toString()}
defaultValue=''
>
</input>

{paginator.lastPage !== undefined ? ' / ' : ''}

{paginator.lastPage !== undefined ? <div className='last-page'>
{paginator.lastPage + 1}
</div> : ''}
</div>

<button
className='next-page'
onClick={paginator.loadNext}
disabled={!paginator.hasNext()} >
<FontAwesomeIcon icon='angle-right' />
</button>

<button
className='last-page'
onClick={paginator.loadLast}
disabled={paginator.lastPage === undefined || paginator.isLast()}>
<FontAwesomeIcon icon='angle-double-right' />
</button>
</div>
);
}
}
7 changes: 7 additions & 0 deletions src/dash-table/components/PageNavigation/props.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { IPaginator } from 'dash-table/derived/paginator';

export interface IPageNavigationProps {
paginator: IPaginator;
page_current: number;
page_count: number | undefined;
}
Loading