changing the properties/attributes of a combobox

2 posts, 1 answers
  1. Vijay
    Vijay avatar
    19 posts
    Member since:
    May 2011

    Posted 29 Jan 2014 Link to this post

        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
    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

  2. Answer
    Dimo avatar
    8404 posts

    Posted 31 Jan 2014 Link to this post

    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.

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top