This is a migrated thread and some comments may be shown as answers.

Dropdown Multi Column and Blank Item

3 Answers 219 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 19 Jun 2014, 09:17 PM
How do I create a DropDownList with a blank item as well as multi column template?
   
var ticketType = $("#TicketType").kendoDropDownList
({
    optionLabel: " ",
    dataTextField: "TicketTypeName",
    dataValueField: "TicketTypeId",
    dataSource:
    {
        serverFiltering: true,
        type: "jsonp",
        transport:
        {
            read:
            {
                url: "../Service/IncidentManagement.asmx/GetTicketTypeList",
                contentType: "application/json; charset=utf-8",
                type: "POST"
            }
        },
        schema:
        {
            data: "d"
        }
    },
    template: "<div><span>${TicketTypeName}</span><span>${TicketTypeDescription}</span></div>"
}).data("kendoDropDownList");

The above produces the error Uncaught ReferenceError: TicketTypeDescription is not defined.

If I remove the optionLabel then it displays fine, but without the empty entry.
If I remove the template then it displays fine, but without multi column. 

3 Answers, 1 is accepted

Sort by
0
Accepted
Kiril Nikolov
Telerik team
answered on 23 Jun 2014, 07:57 AM
Hi Jonathan,

The problem comes from the fact that the optionLabel does not know about the other properties of the data object. So you need to set some values, even empty ones, in order to work correctly. Please check the following example:

http://jsbin.com/habapuse/4/edit

It is explained in the following article:

http://docs.telerik.com/kendo-ui/api/web/dropdownlist#configuration-optionLabel

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Jonathan
Top achievements
Rank 1
answered on 24 Jun 2014, 07:58 PM
Thanks Kiril, works like a charm.
0
Kiril Nikolov
Telerik team
answered on 26 Jun 2014, 07:55 AM
Hi Jonathan,

I am glad I helped.

In case you have any further questions please do not hesitate to contact us.

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
DropDownList
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Jonathan
Top achievements
Rank 1
Share this question
or