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 dropdown resets for lazy loading dataTable #331

Closed
sudheerj opened this issue Mar 6, 2018 · 2 comments
Closed

Pagination dropdown resets for lazy loading dataTable #331

sudheerj opened this issue Mar 6, 2018 · 2 comments
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@sudheerj
Copy link
Contributor

sudheerj commented Mar 6, 2018

The table pagination dropdown value resets to default one when you do fitering on lazyloading dataTable. This can be replicated with latest version(1.4.2)

@Merve7
Copy link
Contributor

Merve7 commented Mar 9, 2018

Do you use the line property like rows={10}? If so, please try ;

constructor() {
        super();
        this.state = {
            //others
            rows:10
        };
       //others
        this.onLazyLoad = this.onLazyLoad.bind(this);
    }

onLazyLoad(event) {
    /* In a real application, make a remote request to load data using state metadata from event
     * event.first = First row offset
     * event.rows = Number of rows per page
     * event.sortField = Field name to sort with
     * event.sortOrder = Sort order as number, 1 for asc and -1 for dec
     * filters: FilterMetadata object having field as key and filter value, filter matchMode as value */

    //imitate db connection over a network
    setTimeout(() => {
        if(this.datasource) {
            this.setState({cars: this.datasource.slice(event.first, (event.first + event.rows)), rows:event.rows});
        }
    }, 250);
}
// in render
<DataTable value={this.state.cars} paginator={true} rows={this.state.rows} header={header} totalRecords={this.state.totalRecords}  lazy={true} onLazyLoad={this.onLazyLoad} rowsPerPageOptions={[5,10,20]}  filters={this.state.filters} onFilter={this.onFilter}>

If it doesn't work, please create a plunker(https://plnkr.co/edit/uHHN7wKskRgpHszbPZtj?p=preview).

@cagataycivici cagataycivici self-assigned this Mar 14, 2018
@cagataycivici cagataycivici added the Type: Bug Issue contains a defect related to a specific component. label Mar 14, 2018
@cagataycivici cagataycivici added this to the 1.5.0 milestone Mar 14, 2018
@cagataycivici
Copy link
Member

Replicated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

No branches or pull requests

3 participants