question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SelectedItems with primaryKey field only

See original GitHub issue

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

this.dropdownList = [
      { "id": 1, "name": "India" },
      { "id": 2, "name": "Singapore" },
      { "id": 3, "name": "Australia" },
      { "id": 4, "name": "Canada" },
      { "id": 5, "name": "South Korea" },
      { "id": 6, "name": "Brazil" }
    ];

// Should allow selected items to be only array of primarykey
//  this.selectedItems = [ 'India', 'Singapore', 'Australia']; 
     
this.selectedItems = [
      { "id": 1, "name": "India" },
      { "id": 2, "name": "Singapore" }];

this.settings = {
      text: "Select Countries",
      selectAllText: 'Select All',
      unSelectAllText: 'UnSelect All',
      primaryKey: 'name',
      labelKey: 'name',
    };

https://stackblitz.com/edit/angular2-multiselect-dropdown-bug-sbzntx

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:6
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
cciccolecommented, Aug 4, 2019

+1

I’ll add that it’s not clear to me what the purpose of primaryKey is

1reaction
getharicommented, Jul 2, 2020

Ah here I am 2 Years later, is this available ? Or is there a timeline ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Retrieving Primary Key Field Values for Selected Items
You can use the DataKeyNames and DataKeyValues arrays of the GridTableView object for this purpose. When you specify a primary key field by...
Read more >
Entity Framework generic method to retrieve primary key from ...
A better route is to define a base class that your entities all derive from that include those kinds of common fields.
Read more >
Combo Box Selected Items - Lookup Field Issues
By default, the Dataverse lookup field itself will only have the primary column (such as Name), and the primary key (GUID), of the...
Read more >
How can I retrieve the primary key of the selected item in a ...
I just added question marks around serviceProviderComboBox.SelectedItem and productComboBox.SelectedItem. I don't know what put here. Sorry, I ...
Read more >
Combo box control in Power Apps | Search, Filter, Large Data ...
... default selected items, selected items, connecting to data source, ... multiple fields ✓ Combo box as people picker ✓ Power Apps Combo ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found