Reputation: 3
I want to create a Kendo UI (for jquery) DropDownList with a few list items such that the font size of every list item is different. Lets say there are 3 items in the DropDownList, then each of the three must show in a different font size. Is it possible?
Upvotes: 0
Views: 198
Reputation: 2494
Sure, one of possibilities is to return font size in datasource.
var data = [
{ text: "Black", value: "1", fontSize: "12px" },
{ text: "Orange", value: "2", fontSize: "18px" },
{ text: "Grey", value: "3", fontSize: "24px" }
];
Then use kendo DropDownList templates for valueTemplate
and template
:
$("#color").kendoDropDownList({
dataTextField: "text",
dataValueField: "value",
valueTemplate: '<label style="font-size: #:fontSize#">#:data.text#</label>',
template: '<label style="font-size: #:fontSize#">#:data.text#</label>',
dataSource: data,
index: 0,
change: onChange
});
This is modified version of kendo example: font size per item
Upvotes: 1