d48
d48

Reputation: 692

kendo dropDownList issue where setting index not working to select initial option value

Has anyone else ran into this issue? setting index for the kendoDropDownList option is not working

$("#color").kendoDropDownList({
    dataTextField: "text",
    dataValueField: "value",
    dataSource: data,
    index: 2,
    change: onChange
});

You can view on this fiddle http://jsfiddle.net/design48/E57J3/7/. It should select 3rd item for Gray for color drop down

Upvotes: 1

Views: 4938

Answers (1)

OnaBai
OnaBai

Reputation: 40917

The problem is not in your kendoDropDownList but the fact that you set the color multiple times.

You set it in Kendo DropDownList when you say:

$("#color").kendoDropDownList({
    dataTextField: "text",
    dataValueField: "value",
    dataSource: data,
    index: 2,
    change: onChange
});

You do it again in:

color.select(0);

And once again in:

<input id="color" value="1" />

Try removing all but one and you get the right value.

Check it here http://jsfiddle.net/OnaBai/E57J3/8/

Upvotes: 5

Related Questions