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

set combobox value & display

Thread ID:

Created:

Updated:

Platform:

Replies:

140861 Nov 12,2018 02:28 AM UTC Nov 12,2018 08:55 AM UTC JavaScript - EJ 2 3
loading
Tags: ComboBox
jeff
Asked On November 12, 2018 02:28 AM UTC

Hi,

I use the statement to assign the input value 

 var item = JSON.parse(data);
     for (var i in item) {
         $('#' + i).val(item[i]);
        $('input[name="' + i + '"]').val(item[i]);
     }

But Combobox just display value , It shuld display text message
I could display combobox text message






Prince Oliver [Syncfusion]
Replied On November 12, 2018 06:54 AM UTC

Hi Jeff, 

Thank you for contacting Syncfusion support. 

Based on the shared code, we could see that you have directly bound the value to the control’s input element. To set the value and display the text in the control, make sure that you have bound both the value and text fields and then you need to use the control’s value property. So, we suggest you to set the value for ComboBox using value property. Kindly refer to the following code snippet. 
  
document.getElementById("btn1").addEventListener("click", function () { 
    var item = [{ Id: "game3" }]; 
    var instance = document.getElementById("country").ej2_instances[0]; //Accessing Control’s instance 
    for (var i in item) { 
        instance.value = item[i].Id; //setting using value property 
    } 
}); 

We have attached a sample for your reference, please find the sample at the following location: https://stackblitz.com/edit/ccfc55   

Kindly refer to the following API documentation for Value and Text property 

If the issue persists , Kindly provide additional information on the issue with sufficient code to replicate the issue in our end. It will help us provide solution at the earliest. 

Regards, 
Prince 


jeff
Replied On November 12, 2018 07:49 AM UTC

Hi, 

Could U give me the Javascript EJ1 sample

Prince Oliver [Syncfusion]
Replied On November 12, 2018 08:55 AM UTC

Hi Jeff, 

Thank you for your update. 

Please find the JavaScript example for the EJ1 ComboBox control in the following link: https://jsplayground.syncfusion.com/34hmm2ge 

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

or the page will be automatically redirected to 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

;