This is a migrated thread and some comments may be shown as answers.

Updating DropDownList Items Text

0 Answers 138 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
JQuery
Top achievements
Rank 1
JQuery asked on 21 Mar 2012, 09:37 PM
Hello,

I'm evaluating KendoUI for a project. One of the needs is to be able to dynamically update the text of the items in a DropDownList. With traditional HTML / JQuery, I can do the following:

<select id="myOptions">
  <option value="0">Some Text</option>
  <option value="1">Some Other Text</option>
  <option value="2">Third Option Text</option>           
</select>
 
...
 
$("#myOptions option[value='0']").text(getUpdatedText(0));
$("#myOptions option[value='1']").text(getUpdatedText(1));
$("#myOptions option[value='2']").text(getUpdatedText(2));

This works exactly as desired. I've tried something similar in Kendo, however, I haven't had any success. My most recent attempt looks like this:

<select id="myOptions">
  <option value="0">Some Text</option>
  <option value="1">Some Other Text</option>
  <option value="2">Third Option Text</option>          
</select>
  
...
  
$("#myOptions").kendoDropDownList();
$("#myOptions option[value='0']").text(getUpdatedText(0));
$("#myOptions option[value='1']").text(getUpdatedText(1));
$("#myOptions option[value='2']").text(getUpdatedText(2));
$("#myOptions").data("kendoDropDownList").refresh();

Unfortunately, the text of the options never updates. The reason I need to do this is because I need to update the text of the options on a regular interval. Can someone please tell me what I'm doing wrong?

Thank you!

No answers yet. Maybe you can help?

Tags
DropDownList
Asked by
JQuery
Top achievements
Rank 1
Share this question
or