Javascript 剑道格网输入字段未在';模糊';事件JQuery
我的剑道网格由复选框行组成,每个复选框行都有一个付款金额输入文本字段。我一直在尝试让剑道网格上的输入字段在用户更改字段值或离开字段时立即更新总数,否则使用“模糊”事件,但由于某种原因,它不会触发。我怀疑它们是剑道中的一些内部标志,它们要么没有检测到剑道,要么覆盖了剑道方法。请帮忙!多谢各位Javascript 剑道格网输入字段未在';模糊';事件JQuery,javascript,jquery,kendo-ui,Javascript,Jquery,Kendo Ui,我的剑道网格由复选框行组成,每个复选框行都有一个付款金额输入文本字段。我一直在尝试让剑道网格上的输入字段在用户更改字段值或离开字段时立即更新总数,否则使用“模糊”事件,但由于某种原因,它不会触发。我怀疑它们是剑道中的一些内部标志,它们要么没有检测到剑道,要么覆盖了剑道方法。请帮忙!多谢各位 $(document).ready(function() { $("#orders-grid").kendoGrid({ //Fires off and popula
$(document).ready(function() {
$("#orders-grid").kendoGrid({ //Fires off and populates data for the grid
dataSource: {
autoSync: true,
type: "json",
transport: {
read: {
type: "POST",
dataType: "json",
data: function() {
var data = {
};
addAntiForgeryToken(data);
return data;
}
}
},
change: function (e) {
if (e.action == "itemchange") {
this.sync();
}
},
schema: {
data: "Data",
total: "Total",
errors: "Errors"
},
error: function(e) {
display_kendoui_grid_error(e);
// Cancel the changes
this.cancelChanges();
},
pageSize: @(Model.PageSize),
serverPaging: true,
serverFiltering: true,
serverSorting: true
},
pageable: {
refresh: true,
pageSizes: [@(Model.AvailablePageSizes)],
@await Html.PartialAsync("_GridPagerMessages")
},
editable: {
mode: "inline"
},
//edit: function (e) {
// delete e.model._events.set;
//},
scrollable: false,
dataBound: onDataBound,
persistSelection: true,
columns: [
{
field: "PaymentTotal",
attributes: { style: "text-align:center" },
template: "<input type='text' class = 'paymentTotalGroup'/>",
title: "@T("Invoice.InvoicePaymentList.PaymentTotal")",
width: 150,
},
] //END COLUMNS
});
});
$('#orders-grid').on('change', 'input[type=checkbox][id!=mastercheckbox][class=checkboxGroups]', function (e) {
updatePaymentTotal();
//Get total 'CHECKED' checkboxes and display
var numChkBoxesChecked = $('#orders-grid input[type=checkbox][id!=mastercheckbox][class=checkboxGroups]:checked').length;
document.getElementById("totalRowsChecked").innerHTML = numChkBoxesChecked;
updateMasterCheckbox();
});
//On blur event not firing ------------------------------------------------------------
$('#orders-grid').on('blur', 'input[type=text][class=paymentTotalGroup]', function (e) {
updatePaymentTotal(); //NOT WORKING!
});
$(文档).ready(函数(){
$(“#orders grid”).kendoGrid({//为网格触发并填充数据
数据源:{
自动同步:对,
键入:“json”,
运输:{
阅读:{
类型:“POST”,
数据类型:“json”,
数据:函数(){
风险值数据={
};
addAntiForgeryToken(数据);
返回数据;
}
}
},
更改:功能(e){
如果(如动作==“项目变更”){
this.sync();
}
},
模式:{
数据:“数据”,
总计:“总计”,
错误:“错误”
},
错误:函数(e){
显示网格错误(e);
//取消更改
这个.cancelChanges();
},
pageSize:@(型号:pageSize),
对,,
是的,
服务器排序:true
},
可分页:{
刷新:是的,
页面大小:[@(Model.AvailablePageSizes)],
@等待Html.partialSync(“GridPagerMessages”)
},
可编辑:{
模式:“内联”
},
//编辑:功能(e){
//删除e.model.\u events.set;
//},
可滚动:false,
数据绑定:onDataBound,
选择:对,,
栏目:[
{
字段:“PaymentTotal”,
属性:{style:“文本对齐:中心”},
模板:“”,
标题:“@T”(“Invoice.InvoicePaymentList.PaymentTotal”),
宽度:150,
},
]//结束列
});
});
$('#orders grid')。在('change','input[type=checkbox][id!=mastercheckbox][class=checkboxGroups]'上,函数(e){
updatePaymentTotal();
//获取总“选中”复选框并显示
var numchkboxchecked=$(“#命令网格输入[type=checkbox][id!=mastercheckbox][class=checkboxGroups]:选中”)。长度;
document.getElementById(“totalRowsChecked”).innerHTML=numchBoxeschecked;
updateMasterCheckbox();
});
//关于模糊事件不触发------------------------------------------------------------
$('#orders grid')。在('blur',输入[type=text][class=paymentTotalGroup]',函数(e){
updatePaymentTotal();//不工作!
});
您的代码似乎正常。如果我是你,我会检查两件事。首先,我的选择器在事件处理程序中是否正确。其次,在创建change
和blur
事件处理程序之前,应该完全构建网格。也许调用数据绑定上的on
函数?