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

ComboBox null error

1 Answer 81 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Gary
Top achievements
Rank 1
Gary asked on 30 Dec 2015, 07:15 PM

Hi

I am working through some Telerik sample code and having some errors. I am trying to understand how it works in order to troubleshoot the problem.

Specifically, I am using a ComboBox widget with an id value (let's call it comboID) which is set in the .Name property.

 

 Now this code from the sample:

$(comboID).each(function () {

eval($(this).children("script").last().html());

});

I think adds a new combo box. What does the ("script") keyword signify?

Now I need to find the ComboBox and update the selected item. 


$(comboID).data().kendoComboBox.value(status);

But get undefined for the kendoComboBox. I'm not sure what this line does. I assume we are looking into the DOM but what is the type that is returned?

Thanks for your help. Just trying to understand.

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 04 Jan 2016, 08:54 AM
Hello Gary,

The usage of the script tag that you are referring to, needs to be implemented in scenarios where you have the widgets (combobox in your case), nested in the Grid's client column template. The code-snippet that you have demonstrated is needed so that the widgets could be properly initialized in this scenario.

This implementation:

 eval($(this).children("script").last().html());

should be called in the Grid's dataBound event as demonstrated in the help article below:

http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/grid/faq#how-do-i-use-a-kendo-ui-widget-inside-a-grid-client-column-template


Once being able to initialize the widgets, then you will be able to set the preferable selected item.

Hope this information helps.

Regards,
Nencho
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ComboBox
Asked by
Gary
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Share this question
or