在datagrid 返回的 input中 将修改的值失去焦点就调用修改方法保存到后台 该怎么做?

图片说明


这个是代码

$(function(){
/* 构建表格 */
$('#dg').datagrid({
queryParams: {
},
fit : true, // 适应父容器
method : 'post',
url : contextPath + '/webapp/routeBaseParameter/getRouteBase ParameterList',
toolbar : '#tb',
onLoadError: function(){
alertMsg('数据加载失败!','error');
},
columns : [ [
{
field : 'id',
title : 'id',
width : 200 ,
hidden : true,
align : "center"
},{
field : 'parametersValues',
title : '参数值',
width : 200 ,
formatter:function(value){
return '';
},
align : "center"
}, {
field : 'parametersName',
title : '参数名称',
width : 200,
align : "center"
}, {
field : 'parametersDescribe',
title : '参数描述',
width : 200,
align : "center"
}
] ]
});
// $("#update").change(function(value){
// console.log(this.value)
// });
// $(".cc").event("upperCase()",function(){
// console.log("sdadaas");
// });
});


按照 下面的修改还是进不去这个方法
$(function(){
/* 构建表格 */
$('#dg').datagrid({
queryParams: {
},
fit : true, // 适应父容器
method : 'post',
url : contextPath + '/webapp/routeBaseParameter/getRouteBaseParameterList',
toolbar : '#tb',
onLoadError: function(){
alertMsg('数据加载失败!','error');
},
columns : [ [
{
field : 'id',
title : 'id',
width : 200 ,
hidden : true,
align : "center"
},{
field : 'parametersValues',
title : '参数值',
width : 200 ,
formatter:function(value){
return '';
},
align : "center" ,
}, {
field : 'parametersName',
title : '参数名称',
width : 200,
align : "center"
}, {
field : 'parametersDescribe',
title : '参数描述',
width : 200,
align : "center"
},
] ],
onBeforeCellEdit: function (index, field) {

        },
        onClickCell: function (index, field, value) {
            debugger;
            if (index >= 0 && field=="") {
                $(gridId).datagrid("selectRow", index);
                var row =  $(gridId).datagrid("getRows")[index];
                var editor = $(gridId).datagrid('getEditor', { index: index, field: field });
                if (editor && editor.target) {                    
                    $(editor.target).bind("change", function (e) {                                

                    });                                    
                }
            }
        },
        onEndEdit: function (index, row, changes) {               
            if (changes != null) {
                var cell = $(gridId).datagrid("cell");
                if (cell != null) {
                    if (cell.field == '') {

                    }
                }
            }            
        }
    });

});

使用change事件

$(gridId).datagrid({            
        onBeforeCellEdit: function (index, field) {      

        },
        onClickCell: function (index, field, value) {
            if (index >= 0 && field=="???") {
                $(gridId).datagrid("selectRow", index);
                var row =  $(gridId).datagrid("getRows")[index];
                var editor = $(gridId).datagrid('getEditor', { index: index, field: field });
                if (editor && editor.target) {                    

                    $(editor.target).bind("change", function (e) {                                

                    });                                    
                }
            }
        },
        onEndEdit: function (index, row, changes) {               
            if (changes != null) {
                var cell = $(gridId).datagrid("cell");
                if (cell != null) {
                    if (cell.field == '???') {

                    }
                }
            }                
        }
});

onAfterEdit( rowIndex, rowData, changes) 事件试过了吗