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

changing the properties/attributes of a combobox

1 Answer 315 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Vijay
Top achievements
Rank 1
Vijay asked on 29 Jan 2014, 01:28 PM
Hi,
    I am using plain HTML and jquery to create kendo comboboxes and bind data to it. My problem is that I want to change the datatextfield and datavaluefield of the combo based on some values. Initially what I will do is I shall initialise the combobox like this
$("#TestControl").kendoComboBox(
{
placeholder: "Select Product",
filter: "contains",
autoBind: false,
suggest: true,
minLength: 0
});

Then at some other place I wnat to assign the datatextproperty to the control something like this.

 auto = $("#TestControl").data("kendoComboBox");
 auto.setDataSource(dataSource);  // this line works
auto.options.dataValueField = autoCompleteValueField; // this line I am not sure (autoCompleteValueField is a variable which has a value)
auto.options.dataTextField = autoCompleteTextField; // this line I am not sure (autoCompleteTextField is a variable which has a value)


Can this be done or is there a way to do it? Please do help

Thanks in advance

Regards,
Vijay

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 31 Jan 2014, 10:08 AM
Hello Vijay,

Changing the dataTextField and dataValueField after initialization is not supported. If you need to change these, you can destroy() the ComboBox and create a new instance. You can create a new instance from the same element, which you have used to create the first instance.

http://docs.telerik.com/kendo-ui/getting-started/widgets#destroying-kendo-ui-widgets

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ComboBox
Asked by
Vijay
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or