Dropdown value set

I am getting An ProjID = 1
PodId = 5
AssignedToId =3

I am getting Pod data and Assigned to data based on ProjID 
I am able to load the data in the dropdownlist but i am not able to set the selected PodId and AssignedToId  for the dropdowns.

The ID's are loaded first the Lookup data is loaded Asynchronusly.
is it timing issue?
How to overcome the issue?


3 Replies 1 reply marked as answer

PM Ponmani Murugaiyan Syncfusion Team May 21, 2021 03:45 PM UTC

Hi vin, 

Thanks for contacting Syncfusion support. 

Based on the provided information, we suspect that the preselected value is updated to the component before the data is fetched from asynchronously. So that the provided Id for value property will search for corresponding text and if it is not found, will update the Id to the component. We suggest you to update the value property after the data is assigned to datasource property as like below code nsippet. 

<ejs-dropdownlist #dropdownlistObj [dataSource]='itemTags | async' placeholder='Workshop.ITEM_GROUP' (filtering)="onFiltering($event)" [allowFiltering]='true' [filterType]="filterType" floatLabelType='Auto' 
[showClearButton]="true" [fields]='fields' [value]='value'></ejs-dropdownlist> 

ngOnInit(): void { 
    this.itemTags = this.dataService.fetch(''); 
    this.value = 'Game6'; 
  } 


If issue still exists in your end, please revert us with additional information like when you are updating the preselected value to component, share code snippet and if possible share simple issue replicating sample, which helps us to check and provide you the solution at earliest. 

Regards, 
Ponmani M 


Marked as answer

VI vin June 6, 2021 11:45 PM UTC

What is the difference between  using ngModel and value?

 [(ngModel)]="data.podSelValue"

 [
value=  'value
'


PM Ponmani Murugaiyan Syncfusion Team June 7, 2021 12:08 PM UTC

Hi vin, 

Thanks for the update. 

Please find the difference between ngModel and value. 

ngModel 
Value 
  1. ngModel is a directive to achieve two-way data binding.
  2. Which stores the required user value in a variable and we can use that variable whenever we require that value.
  3. It is also used during validations in a form.
Value which gets or sets the value of the selected item in the component. 

Regards, 
Ponmani M 


Loader.
Up arrow icon