Prepopulate the values

I am making a raay dynamically for prepopulate the values of multiselect but not able to do that.

Here is my code:-

in Html:-
  <ejs-multiselect #adminList id='adminList' [dataSource]='adminDataSource' [allowFiltering]="true" mode='Box'
                             [fields]='fields' floatLabelType="Always" placeholder='Select Project Admin'
                             formControlName="Admin" [value]="value1">

            </ejs-multiselect>


In ts file:-

following code is not working:-

 for (let j = 0; j < data.length; j++)
                    {
                      this.value2.push((data[j].EntityUserId));
                      
                    }

Note:- Data have two rows in which data[1].EntityUserId=5 and data[2].14

following is working:-
  this.value1 = [5, 14];

Please help

3 Replies 1 reply marked as answer

BC Berly Christopher Syncfusion Team June 11, 2020 10:16 AM UTC

Hi Namita, 
  
Greetings from Syncfusion support. 
  
We have checked the provided code example and noticed that you have pushed the value from the datasource in to the value2 array and bind the value1 variable to the MultiSelect component. But, we need to push into the variable which is bind to the value property to render the MultiSelect with pushed value. Kindly refer the below code example. 
  
  
If we misunderstood your query, please share the elaborate details about the requirement that will help us to check and proceed further at our end. 
  
Regards, 
Berly B.C 


Marked as answer

NA Namita June 12, 2020 01:22 AM UTC

Its working, Thanks


BC Berly Christopher Syncfusion Team June 12, 2020 04:14 AM UTC

Hi Namita, 
  
We are glad to know that your issue is resolved. Please let us know if you need further assistance on this. 
  
Regards, 
Berly B.C 


Loader.
Up arrow icon