patternfly / angular-patternfly

This repo contains instructions and the code for a set of Angular 1 components for the PatternFly project.
http://www.patternfly.org/angular-patternfly/
MIT License
123 stars 90 forks source link

Fix for #740: pfTableView-with-Toolbar: cannot select all rows after clearing filters #743

Closed dtaylor113 closed 6 years ago

dtaylor113 commented 6 years ago

Hi @alexkieling, The 'Select All' table checkbox seems to lose binding to the controller's 'toggleAll()' method after (a) clearing all or any one filter or (b) applying a second filter. I spent an entire afternoon trying to figure out why this is happening; trying many suggested solutions such as changing to ng-click or using an object for the ng-model value. The only solution I could find is calling addNewComponentToDOM() for the usecases mentioned above. This is not ideal, as the entire table is redrawn in those situations. However, the controller bindings continue to work after multiple filters are applied or cleared.

As you can see, applying the first filter doesn't cause the table to be redrawn, however adding multiple filters or clearing filters will cause the redraw:

table-select-all-w-filters

This is somewhat of a work-around as nothing has changed in the actual TableView component, just in the ngDoc example, so feel free to use the suggested solution if it's acceptable to you.

Fixes #740 ? :-)

Thanks,

abkieling commented 6 years ago

Your solution is to remove and add the whole table using ngIf, correct? Did you try doing the same thing just for the checkbox?

dtaylor113 commented 6 years ago

Your solution is to remove and add the whole table using ngIf, correct?

Yes, in the demo code

Did you try doing the same thing just for the checkbox?

No, I haven't tried that. The 'Select All' checkbox is part of the transcluded HTML which is bound to underlying datatables.net component. Not sure ngif there would help.

angular-datatables has an example of the select all checkbox, I was going to compare it to how it is implemented in angular-patternfly: http://l-lin.github.io/angular-datatables/archives/#!/rowSelect

dtaylor113 commented 6 years ago

@alexkieling do you have any issues with me merging this PR? -thanks

abkieling commented 6 years ago

@dtaylor113 no issues, go ahead