Published on

Debugging a Kendo Template Loop

Authors

This just occurred to me as I was kendo templating so I thought I’d share it.  Seems obvious, but you know… :)

Anyway here’s a sample KendoUI Template

So you can see inside the pound signs we’re using a plain old javascript for loop!

Actually as long as you put a couple pound signs you can execute ANY javascript code in the template; which is nice:)  Other frameworks use “syntax sugar” to wrap the functionality into the string to be parsed out later like {{if}} for example.

Initially I was against this pound syntax, but really it’s saved me a bunch of times where another framework would have hamstrung me because it didn’t support complex logic in the “sugar”.  Consider me converted!

So if we think about it, then we could easily use the standard javascript debugging methods we’re all used to…including console.log(), alert(), etc etc!

Here be me fiddle, enjoy