Kendo UI dropdown list - different background color to each list item -
how provide different background colors each list item (non-selected) in kendo ui dropdown list rather giving common background color whole dropdown?
you should defined template sets appropriate color.
example:
define datasource as:
var colors = [ "red", "green", "pink", "blue", "yellow" ];
and template as:
<script id="template" type="text/kendo-script"> <div style="background-color: #= data #">#= data #</div> </script>
then dropdownlist definition should as:
var template = kendo.template($("#template").html()) $("#dropdownlist").kendodropdownlist({ datasource: colors, template : template });
working example here: http://jsfiddle.net/onabai/mzlrs/
Comments
Post a Comment