As I understand, there are two (equal ?) ways to declare widget initialization: constructor and data attributes. However, I am seeing two different behaviors (in regard to templates specifically) depending on how I initialized say the ListView widget.
Constructor:
vs. Declarative:
See my jsFiddle it shows both flavors of ListView's above:
The listview via constructor renders the LastName as undefined from the template span data-bind?
I think this is related, as the demo for editing a listview uses two templates (display and edit) and constructor initialization. The edit template does use data-bind elements, but it only works while in edit mode?. If you try the same on the display template, that does not work - not sure what or why the difference is to the control or data?
Thanks for any insight!
Jim
Constructor:
$('#listView_C').kendoListView({ selectable: true, template: kendo.template($("#template").html()), change: viewModel.onChange, mousedown: viewModel.onMouseDown, dataSource: { data: viewModel.listSource, pageSize: 10 }});vs. Declarative:
<div id="listView_D" data-role="listview" data-selectable="true" data-bind="source: listSource, events: { change: onChange, mousedown: onMouseDown }" data-template="template"></div>See my jsFiddle it shows both flavors of ListView's above:
The listview via constructor renders the LastName as undefined from the template span data-bind?
<script type="text/x-kendo-tmpl" id="template"> <div class="customers"> <dl> <dt>First Name</dt> <dd>#=FirstName#</span></dd> <dt>Last Name</dt> <dd><span data-bind="text: LastName" ></span></dd> </dl> </div></script>I think this is related, as the demo for editing a listview uses two templates (display and edit) and constructor initialization. The edit template does use data-bind elements, but it only works while in edit mode?. If you try the same on the display template, that does not work - not sure what or why the difference is to the control or data?
<!-- editTemplate works --><dd> <input type="text" data-bind="value:ProductName" name="ProductName" required="required" validationMessage="required" /> <span data-for="ProductName" class="k-invalid-msg"/></dd><!-- template - works --><dd>${ProductName}</dd><!-- template - change to data-bind does not work --><input type="text" data-bind="value:ProductName" name="ProductName" />Thanks for any insight!
Jim