Open anikets43 opened 5 years ago
+1
I'll add that it's not clear to me what the purpose of primaryKey is
primaryKey is to make the dropdown identify the list items by unique property name, which is different for different data sets and users. The feature is already available. Please check 'primaryKey' in settings.
@CuppaLabs this is not working correctly and shouldn't be closed.
If you do believe it is working correctly, could you fix this stackblitz (https://stackblitz.com/edit/angular2-multiselect-dropdown-bug-ng4bsf)? The desired behavior is that an array of names should print to the console upon selection instead of an array of objects.
@cciccole The events will only return objects... Please not that further manipulation of the object you need to take care in the callback methods. So cannot give it as component feature.
@CuppaLabs I'm fine with the events only returning objects. We're only using events in the stackblitz example such that we can print the ngModel array. Data binding is what this request is about.
To be clear, the request at hand is that we can accomplish data binding with an attribute of the objects in the multiselect-dropdown and not just with the objects themselves.
If you consider anikets43 example closely, the desired behavior is that this.selectedItems
should be an array of names and not an array of objects. The stackblitz I shared with you indicates that this is not possible.
This is a functionality found in other multiselect dropdown components (exact example here) but not in angular2-multiselect-dropdown
. Maybe I'm wrong, but it doesn't seem like you are quite understanding our request.
Let me know if this clarification helps, and if you think it's reasonable to support this request.
@cciccole You are correct ! This is a reasonable good ask. Let me take this up for next release
For what it's worth, i was looking for the same thing and came across this. Is there any planned timeline for the next release / for this feature ? I do see a 4.5 that came out recently, but guessing this is not solved there
Ah here I am 2 Years later, is this available ? Or is there a timeline ?
We usually store only ids/value field in the DB for dropdown items. While fetching the record, we have only list of selected ids/value i.e. ['Singapore', 'India'] instead of array of objects.
It would be good to have this feature where developer don't have to manipulate the data for to pre-populate the selectedItems
https://stackblitz.com/edit/angular2-multiselect-dropdown-bug-sbzntx