We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Dropdownlist with true or false as values in dataSource

Thread ID:

Created:

Updated:

Platform:

Replies:

142709 Feb 15,2019 05:19 PM UTC Feb 18,2019 10:58 AM UTC Angular - EJ 2 1
loading
Tags: DropDownList
Luis Lora
Asked On February 15, 2019 05:19 PM UTC

I have a dropdownlist and data value is true or false. This is the data:

public estados: any[] = [ { value: false, text: 'Sin realizar' },{ value: true, text: 'Realizado' }];

And this is the HTML

<ejs-dropdownlist name="estado" [(ngModel)]="model.realizado" [dataSource]='estados' [placeholder]='"Selecciona"' [allowFiltering]='false'></ejs-dropdownlist>

The problem is dropdownlist does not select the ngModel value, always shows placeholder.

Thank you very much.

Prince Oliver [Syncfusion]
Replied On February 18, 2019 10:58 AM UTC

Hi Luis,  

Thank you for contacting Syncfusion support. 

We have checked your code snippet, you have missed to update the ngModel value from component. We have prepared sample based shared code. Please refer the below code snippet. 

[html] 
<ejs-dropdownlist name="estado" [(ngModel)]="realizado" [dataSource]='estados' ></ejs-dropdownlist> 

[component.ts] 
export class DataBindingDropDownListComponent { 
    // define the JSON of data 
    public estados: any[] = [ { value: false, text: 'Sin realizar' },{ value: true, text: 'Realizado' }];   
    public realizado = "Realizado"     
} 

We have attached the sample for your reference, please find the sample at the following location 

Please let us know if you need any further assistance on this. 

Regards, 
Prince 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;