Kendo listview with many edit template

288 Views Asked by At

I use a kendo list view to show my records.

According to a field value, I would like use a different edit template on a field:

  • if my field value type is a image, i would like show a kendo upload
  • if my field value type is a text, i would like show a kendo editor

Is it possible ? Do you have a sample ? a idea ?

Thanks for your help

1

There are 1 best solutions below

0
GaloisGirl On

As you can see in the template documentation, templates can have JavaScript code in them, including if/else blocks:

<script type="text/x-kendo-template" id="myTemplate">
    #if(isAdmin){#
        <li>#: name # is Admin</li>
    #}else{#
        <li>#: name # is User</li>
    #}#
</script>

Just check your type in an if block and use whatever controls you need for that type.