Search code examples
javascriptangularjskendo-uikendo-dropdown

kendo dropdownlist shows optionlabel in dropdown


I am using kendodropdown. I used optionLabel = "Actions" and it is displayed as an option in the dropdown how do I ignore it as a value in dropdown.

Is there a way where we can stop or hide optionLabel in kendo dropdownlist to be displayed as an option in the dropdown.

var $dropdownElement = $("<input />");

$dropdownElement.appendTo($dropdownContainer);
$dropdownElement.kendoDropDownList({
        dataTextField: "text",
        dataValueField: "value",
        dataSource: dropdown.items,
        optionLabel: 'Actions'
})

As of now Actions is displayed as an option in the dropdown please help me to ignore it as a value in dropdown.


Solution

  • This is the solution that worked well, I am hiding the first element when I click the dropdown.

    var $dropdownElement = $("<input />");
    
    $dropdownElement.appendTo($dropdownContainer);
    $dropdownElement.kendoDropDownList({
            dataTextField: "text",
            dataValueField: "value",
            dataSource: dropdown.items,
            optionLabel: 'Actions',
            open: function () { $($dropdownElement).getKendoDropDownList().list.find("li.k-item").first().hide(); 
                    }
    })