angularjs-dropdown-multiselect icon indicating copy to clipboard operation
angularjs-dropdown-multiselect copied to clipboard

displayProp in extra-settings with multiple fileds

Open Planet910 opened this issue 8 years ago • 1 comments

I currently have this settings for my dropdown:

$scope.attachDropdownSettings = {
            enableSearch: true,
            showCheckAll: false,
            showUncheckAll: false,
            displayProp: 'name',
            scrollable: true,
            scrollableHeight: 250,
            idProperty: 'id',
        };

I need to have multiple fields in the displayProp or to be more specific I need to take some value from another array of object and i need to have in displayProp an expression or a function like this:

$scope.attachDropdownSettings = {
            enableSearch: true,
            showCheckAll: false,
            showUncheckAll: false,
            displayProp: function(currentItem){
                  return anotherObject.value + " - " + currentItem.name;
            },
            scrollable: true,
            scrollableHeight: 250,
            idProperty: 'id',
        };

Is it possible to do something like this in any way? I really need to do this.

Planet910 avatar Jul 24 '17 10:07 Planet910

@Planet910 : could it be an option for you to build a variable where you can dump everything you need? let's say that you add to your options list a property called msDisplay:

const myList = fetch('your list here'); myList = myList.map(el=> Object.assign(el, {msDisplay: anotherObject.value + " - " + el.name}));

Then your dropdown could look like this:

 <ng-dropdown-multiselect  options="myList " ... />

Silverium avatar Jul 27 '17 08:07 Silverium