I'm working with ASP.NET and using a Kendo listview. I have a checkbox within my listview that is bound to the datasource. The first time the checkbox is checked the datasource is updated. If I uncheck the checkbox, the datasource is not updated. In Chrome, I manually bound the checkbox and datasource after the first check and was able to successfully rebind them. is anyone able to determine what is breaking my bindings?
Here is my listview template:
<script type="text/html" id="buyindividualduebacktemplate">
<div class="row dueback-list-item">
<div class="col-xs-3"><b>@Html.Evention().Resource(Balance)</b> #=kendo.toString(Balance,"c")# </div>
<div class="col-xs-3"><b>@Html.Evention().Resource(Drop)</b> \#: #=DepositEnvelopeId#</div>
<div class="col-xs-3"><b>@Html.Evention().Resource(Date)</b><span>: #=DateString#</span></div>
<div class="col-xs-3 right"><input type="checkbox" data-bind="checked:Buy" /></div>
</div>
</script>
Here is my listview widget:
@(Html.Kendo().ListView<Evention.Models.BuyIndividualDuebackViewModel>()
.Name(listviewName)
.TagName("div")
.ClientTemplateId("buyindividualduebacktemplate")
.DataSource(datasource =>
datasource.Batch(true)
.Read(read =>
{
read.Url(Url.Action(MVC.Employees.BuyIndividualDueback.ActionNames.Read, MVC.Employees.BuyIndividualDueback.Name));
read.Data(@<text>
function(e) {
e.employeeid = @this.Model.EmployeeId;
e.date = '@(this.Model.Date.HasValue ? this.Model.Date.Value.ToShortDateString() : "")';
}
</text>);
})
.Update(update =>
{
update.Url(Url.Action(MVC.Employees.BuyIndividualDueback.ActionNames.Update, MVC.Employees.BuyIndividualDueback.Name));
update.Data(@<text>
function(e) {
e.signature = $('#sigpad_Signature').signaturePad().getSignatureString();
}
</text>);
})
.Model(m =>
{
m.Id(obj => obj.Id);
m.Field(obj => obj.DateTimeFields);
m.Field(obj => obj.DepartmentId);
m.Field(obj => obj.Amount);
m.Field(obj => obj.AmountToBuy);
m.Field(obj => obj.Balance);
m.Field(obj => obj.Buy);
m.Field(obj => obj.DateString);
m.Field(obj => obj.DepositEnvelopeId);
})
.Events(dsevent =>
{
dsevent.Change(@<text>
function(e) {
if (e.action == "itemchange" && e.field == "Buy" && e.items && e.items.length) {
if (e.items[0].Buy == true) {
e.items[0].AmountToBuy = e.items[0].Balance;
}
else {
e.items[0].AmountToBuy = 0;
}
}
}
</text>);
dsevent.Sync(@<text>
function(e) {
javascript:history.go(-1);
}
</text>);
})
)
.Events(e =>
{
e.DataBound("listview_databound");
}
)
)
And my databound function:
function listview_databound(e) {
var target = e.sender.element;
target.children().each(function (index, item) {
var dataItem = e.sender.dataItem(item);
kendo.bind(item, dataItem);
});
};