angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.37k stars 6.75k forks source link

losing this.selection.selected #10478

Closed tatsujb closed 6 years ago

tatsujb commented 6 years ago

Bug, feature request, or proposal:

request

What is the expected behavior?

can filter, search select and filter by selection

What is the current behavior?

filter deletes selection

What are the steps to reproduce?

https://github.com/angular/material2/blob/master/src/material-examples/table-selection/table-selection-example.html

over here you provide and example for how to select in a mat-table.

there we discover cdk's or your own invention : this.selection.selected.

I find it very useful. and I want to keep using it.

but I can't work out how to combine it with filters and so on.

I have an ion range slider (http://ionden.com/a/plugins/ion.rangeSlider/en.html & packaged for angular : https://github.com/PhilippStein/ng2-ion-range-slider) to select the visible range, not material's page selector.

I set the dataset.data to a sliced version of the array (maybe that's not what I should be doing maybe I'm missing something here, like using a pipe instead).

and the step before, the function that calls the slicing function, is the filtering function which sends the filtered result to the slice function to have it be sliced.

I suspect that I loose the selection data in the process of setting this new value for the dataset.

how can I avoid this?

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 5.2.8 Material 5.2.4 Windows 10 pro Typescript 2.7.0

andrewseguin commented 6 years ago

Would love to help but this isn't the greatest avenue for it. Please try posting on StackOverflow to get troubleshooting advice

angular-automatic-lock-bot[bot] commented 5 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.