nstudio / nativescript-plugins

@nstudio/nativescript-* plugin workspace.
Apache License 2.0
52 stars 40 forks source link

nativescript-filterable-list-picker #30

Open vladymyrkozyr opened 3 years ago

vladymyrkozyr commented 3 years ago

Doest this plugin support showing multiple instances on one page?

davecoffin commented 3 years ago

Forgive my colleague for being so terse! I wrote that plug-in and yes, you can have multiple. There should be documentation explaining, but if you can’t figure it out reopen this ticket and I’ll can help you out!

NathanWalker commented 3 years ago

@vladymyrkozyr let us know which ways you have tried.

vladymyrkozyr commented 3 years ago

Hello again! Thank you for reopening the issue.

So I can explain how I used your component. I imported it in my root angular component app.component.ts like that:

registerElement("FilterableListpicker", () => FilterableListpicker);

Then I wrapped it into my component like this:

ts code:

@ViewChild("filterableListPickerRef") filterableListPickerRef: ElementRef;

onShowPicker() {

this.filterableListPickerRef.nativeElement.show(); } **html code:** "

"

Then when I'm using two instances of it on the same page with two different data sources, it seems to load only one of data sources, doesn't matter which one I open. I guess there is something about using it as view child inside (so two instances reference the same filterablelistpicker).

Do you have any suggestions how I can use several of them one one page?

Thanks in advance

davecoffin commented 3 years ago

Based on the code you provided, you don't need more than one picker, you just need to change listItems based on when its opened. Does that sound right?

valera1401 commented 9 months ago

davecoffin

I have similar issue, 2 List pickers on different pages. open first, select item, go to next page open second, select item go to previous page open list picker on first page, it is showing items from list picker from the second page 🥹 source of the list picker on page 1 contains items from list picker on page 2 How is that possible ? It is 2 different component on different pages. Source arrays aren't shared between pages.