How to change the color of the DropDownList of Kendo UI according to the Status variable?

3

Can anyone tell me if I can change the color of the Kendo DropDownList according to a Status variable?

For example:

If the user is Active - > Assumes the color Green

If the user is Inactive - > Assumes the color Red

If you can not change the color, it can be a way to put a different icon, or some kind of identifier per record.

    
asked by anonymous 19.12.2014 / 19:29

1 answer

3

 var cliente = $("#cboCliente").kendoDropDownList({
    autoBind: true,
    filter: "contains",
    dataTextField: "Nome",
    dataValueField: "Id",
    dataSource: {
        serverFiltering: true,
        transport: {
          read: { url: urlBase + "/principal.php?ACAO=ComboClientes", dataType: "json", type: "POST", data: { MODULO: "Seguranca", TELA:"ClonarUsuario"} },
        },requestStart: function (e) {
           $(".clCarregando").show();
        },
        requestEnd: function (e) {
          $(".clCarregando").hide();
        }
    },
    valueTemplate: '<img class="selected-value" src="Imagens/#:Ativo#.png" style="width: 25px; vertical-align: middle;"/><span> &nbsp; #:Nome#</span>',
    template: kendo.template('<img class="selected-value" src="Imagens/#:Ativo#.png" style="width: 25px; vertical-align: middle;"/><span>  &nbsp; #:Nome#</span>'), });

The "Active" and what I call in the valueTemplate and template comes from my database, so it can be filled with 0 or 1, since the field is bit. I created two images for active and inactive and gave them the name 0 and 1. So when called it will load the corresponding image.

    
13.01.2015 / 19:56