Indranil
Indranil

Reputation: 2713

How to add a Default text on Kendo Drop Down List?

I just want a custom text on the kendo dropdown list. But i have searched on internet and didn't get any solution. So, please any body help me here.

Here is my code:

$("#dropdownlist").kendoDropDownList({
        //headerTemplate: 'Filter by Name',
        dataSource: {
            data: [
                'Filter by Name',
                'Abcd',
                'Xyz',
                'Pqrs',
                'Mno'
            ]
        }
    });

Upvotes: 2

Views: 3747

Answers (1)

NigelK
NigelK

Reputation: 8480

I believe you are looking for 'optionLabel' which shows text for the default empty item. For example:

$("#dropdownlist").kendoDropDownList({
        //headerTemplate: 'Filter by Name',
        dataSource: {
            data: [
                'Filter by Name',
                'Abcd',
                'Xyz',
                'Pqrs',
                'Mno'
            ]
        },
        optionLabel: "Select an item..."
    });

More details here: http://docs.telerik.com/kendo-ui/api/javascript/ui/dropdownlist#configuration-optionLabel

Upvotes: 4

Related Questions