tochoromero / aurelia-table

Simple functional data table for Aurelia
https://tochoromero.github.com/aurelia-table
MIT License
67 stars 25 forks source link

Setting page-size:bind 0 for pagination causes the application to freeze #32

Closed reft closed 6 years ago

reft commented 7 years ago

How to reproduce:

1. Bind the page-size.bind to your result array length:

page-size.bind: organisationsPageSize

2. Retrieve result from server. If no entities was found the value 0 will cause the whole application to freeze. My quick n dirty solution for this was to set the organisationsPageSize value to 1 if 0 entities was found.

  getOrganisations() {
    return this.organisationService.getOrganisations(this.getOrganisationsModel).then(data => {
      this.organisations = data.organisations;

      if (organisations.length === 0)
        this.organisationsPageSize = 1;
    });
  }
esnyder232 commented 7 years ago

Ha! I just ran into this problem myself. I was trying to make an option to turn pagination off and display all results for a table. I thought "0 might be the number to use for pageSize. Let me try that..." Next thing I knew, I was opening task manager to end google chrome.

tochoromero commented 7 years ago

Whoops, it should be easy to disable pagination if pageSize is 0. I will get that in as soon I have a chance.

reft commented 7 years ago

@tochoromero Have you had time to look at this :)? Thanks

tochoromero commented 6 years ago

I have pushed a fix for this. Now, if the pageSize is 0 pagination will be disabled, all the items will be displayed (if any) and the paginator will be hidden by default.

I'm planning a release today with this fix