Reputation: 1182
I am using a kendo dropdownlist and I need a placeholder for the dropdownlist which shouldn't appear in the list when I select the dropdown. I tried using optionLabel but this value shows up in the list.
var $dropdownElement;
$dropdownElement = $("<input />");
$dropdownElement.appendTo($dropdownContainer);
$dropdownElement.kendoDropDownList({
dataTextField: "text",
dataValueField: "value",
dataSource: dropdown.items,
optionLabel: "select your option", //shows as option in dropdown
popup: {
appendTo: $dropdownContainer
}
});
I will need a solution where I can add a placeholder and that value shouldn't be shown as an option in the dropdownlist.
Upvotes: 4
Views: 3465
Reputation: 753
You can always find the first element in the dropwdownn list and hide it to make it look less chatty
$dropdownElement.getKendoDropDownList().list.find("li.k-item").first().hide();
Plunker Dropdownlist (and combobox) example
Upvotes: 1