Hi:
I'm using the event binding to bind a viewmodel function to a div in a template, like this:
<ul id="myList" data-role="listview" data-template="myTemplate" data-bind="source: detail.states"></ul>
<script type="text/x-kendo-template" id="myTemplate">
<div data-role="touch" data-bind="events: { tap: open}">
<div class="response-container">
<div id="text">
${text}
</div>
<div id="controls" class="hidden" style="height: 100px">
<textarea id="response-textarea" maxlength="8000"></textarea>
.
.
.
The "open" function that fires for the tap event changes the class of the inner "controls" div to "unhidden", which just makes a textarea and some other bound buttons visible. In that function, I want to remove the event binding established in the data-bind of the template. In other words, I want to be able to interact with the newly exposed widgets without firing the tap event over and over. One of the exposed buttons sets the class back to hidden, and then I would like to re-enable the tap event binding. This would be trivial, if there wasn't a template involved, but I don't understand how the templating code adds the binding, so removing it is even more obscure.
So the general question is, how do you remove and restore an event binding for a listview item that is added via a template?
Thank you,
Kelly
I'm using the event binding to bind a viewmodel function to a div in a template, like this:
<ul id="myList" data-role="listview" data-template="myTemplate" data-bind="source: detail.states"></ul>
<script type="text/x-kendo-template" id="myTemplate">
<div data-role="touch" data-bind="events: { tap: open}">
<div class="response-container">
<div id="text">
${text}
</div>
<div id="controls" class="hidden" style="height: 100px">
<textarea id="response-textarea" maxlength="8000"></textarea>
.
.
.
The "open" function that fires for the tap event changes the class of the inner "controls" div to "unhidden", which just makes a textarea and some other bound buttons visible. In that function, I want to remove the event binding established in the data-bind of the template. In other words, I want to be able to interact with the newly exposed widgets without firing the tap event over and over. One of the exposed buttons sets the class back to hidden, and then I would like to re-enable the tap event binding. This would be trivial, if there wasn't a template involved, but I don't understand how the templating code adds the binding, so removing it is even more obscure.
So the general question is, how do you remove and restore an event binding for a listview item that is added via a template?
Thank you,
Kelly