I have something like the following
<ul data-template="itemtemplate" data-bind="source: Data">
and my template
<script id="itemtemplate" type="text/x-kendo-template"> <li> <div> <label data-bind="text: Description"> </label> </div> </li> </script>
but I want that my template will be rendered with the useWithBlock property set to false
4 Answers, 1 is accepted
Currently Kendo MVVM initializes the templates with default configuration. This means that useWithBlock is always set to true. There is no way to override this unless the source code is modified.
Regards,Atanas Korchev
the Telerik team
I know this is an older thread, but I had the same question come up today and thought I'd share my solution.
I just put this in a script block that runs before my template is initialized:
kendo.Template.useWithBlock =
false
;
Hope this helps someone.
Jonathan
I took the modified source code route to solve my problem. Performance in IE11 (still used by many on our corporate network) was abysmal, ranging from 60-90 seconds to load a very data-heavy page. By turning off the useWithBlock on the biggest ListView on the page, it now loads in a more "acceptable" 15 seconds. Using the 2016.1.412 release of kendo.mobile.js, I modified the parseOptions method at line 2200 as follows:
function parseOptions(element, options) {
var result = {}, option, value;
for
(option
in
options) {
value = parseOption(element, option);
if
(value !== undefined) {
if
(templateRegExp.test(option)) {
var useWithBlock = !(element.getAttribute(
'data-use-with-block'
) ===
'false'
);
value = kendo.template($(
'#'
+ value).html(), { useWithBlock: useWithBlock });
}
result[option] = value;
}
}
return
result;
}
By adding the data-use-with-block="false" attribute to my mobile ListView widget, I can now specify the behavior on a per-control basis. Hope that helps!