Hi, We're building a large JS app that uses jQuery templates. When the number of templates got out of hand, I moved it to another HTML page, and did a $.get("templates.html") and appended that to the DOM. We load each template one by one. We wanted to do parallel loading using something similar to head.js Maybe you guys can come up with a way of doing it neater. Maybe something like this: kendo.templates.remote = ['templates1.html', 'templates2.html']; kendo.ready(function(){ //kick ass! });
Hello,
There is an available article showing how you can have external templates in your application: https://docs.telerik.com/kendo-ui/framework/templates/load-remote#local-to-external-template-refactoring.
Regards,
Ianko
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Don't make me write a bunch of custom code (or copy somebody's solution) to load MVVM templates from a remote source. Using remote templates is a standard practice that is supported in other frameworks (like AngularJS). It should be supported out-of-the-box. Add a remote template loader, which has the following characteristics: * Expose a method which accepts an array of template specifications. Each specification has the following properties: path: the URL to load the template from tag: the ID to use for the script tag * Loaded templates should be wrapped in a <script> tag with type="text/x-kendo-template"> and appended to the DOM. * Return a jQuery Promise object, which is resolved when all of the specified templates have been loaded and appended to the DOM. * Reject the Promise if any of the templates fail to load. The following is a homebrew solution somebody posted, which uses a DOM event to signal readiness: https://gist.github.com/amirgalor/8705653 This is a good starting point, but not ideal if you have multiple UI scripts which are each loading their own templates.
Indeed RequireJS would be the preferred option at this point to load templates asynchronously.
I'm using requirejs to load my templates, for me this is ok, but build in way would be better
I keep my jQuery templates in an external javascript file and load them in that way...means there's no appending going on and the file is cached ...so I would say allow templates to live in javascript :)
Thanks for the interesting idea! We'll definitely think about ways to make Templating more "scalable" for large applications. To other developers- If you also like this idea of external template support, please add your votes!