easyui datagrid怎么找到具体的单元格 ,然后修改对应的值? datagrid不是有updateRow方法给datagrid定义idField,通过id找到对应的记录下标,调用datagrid更新需要的行数据,datagrid会自动更新dom的内容$('#dg').datagrid('updateRow',{index:$('#dg').datagrid('getRowIndex','数据行的id'),row:{name:'xxxxxx00000'}}) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个方法我知道,但我是在列编辑器combogrid的选中事件中写的,直接用updateRow方法会报错。 这个方法我知道,但我是在列编辑器combogrid的选中事件中写的,直接用updateRow方法会报错。先调用endEdit结束编辑,在执行updateRow 这个方法我知道,但我是在列编辑器combogrid的选中事件中写的,直接用updateRow方法会报错。先调用endEdit结束编辑,在执行updateRow我把代码贴出来:var batchEditor = { type : 'combogrid', options : { panelWidth:450, idField:'BatchNo', textField:'BatchNo', fit: true, fitColumns:true, singleSelect: true, required: true, editable : false, columns: [[ { field: 'BatchNo', title: '批次号', width: 70, align: 'center', sortable: "true" }, { field: 'LocationId', title: '库位ID', width: 70, align: 'center', sortable: "true" , hidden: "true"}, { field: 'LocationName', title: '库位', width: 70, align: 'center', sortable: "true" }, { field: 'CurrentAmount', title: '数量', width: 70, align: 'center', sortable: "true" }, { field: 'Price', title: '价格', width: 70, align: 'center', sortable: "true" }, { field: 'ManufactureDate', title: '生产日期', width: 80, align: 'center', sortable: "true" }, { field: 'ValidityPeriod', title: '有效期', width: 80, align: 'center', sortable: "true" } ]], onSelect:function(rowIndex, rowData) { var drow = $('#detail').datagrid('getSelected'); var index = $('#detail').datagrid('getRowIndex',drow); $('#detail').datagrid('endEdit', index); $('#detail').datagrid('updateRow',{index:index,row:{LocationId:rowData.LocationId,CurrentAmount:rowData.CurrentAmount} } } }报这个错误:[ 你是更新弹出的combogrid还是父grid数据了?看你代码是更新combogrid的,你操作父grid干嘛?获取combogrid的grid,再执行更新 onSelect: function (rowIndex, rowData) { var dg = $(this);//dg为当前弹出的grid的引用 //var drow = $('#detail').datagrid('getSelected'); //var index = $('#detail').datagrid('getRowIndex', drow); //$('#detail').datagrid('endEdit', index); dg.datagrid('updateRow', { index: rowIndex, row: { LocationId: rowData.LocationId, CurrentAmount: rowData.CurrentAmount} }); } combogrid只是父grid的一列的自定义编辑器,是说在combogrid选中一行后,给父grid修改下其他列的值 什么版本的easyui,编辑器能设置为comboeditor,我这里测试没有出现comboeditor,你怎么弄的 easyui 1.3.3那是我加载页面的时候添加了combogrid的扩展方法,才可以使用的:[ onSelect中延时执行看看,可能有冲突。我这里1.3.4测试可以 onSelect: function (rowIndex, rowData) { setTimeout(function () { var drow = $('#detail').datagrid('getSelected'); var index = $('#detail').datagrid('getRowIndex', drow); $('#detail').datagrid('endEdit', index); $('#detail').datagrid('updateRow', { index: index, row: { LocationId: rowData.LocationId, CurrentAmount: rowData.CurrentAmount} }); }, 100); } 我试了下这个方法,好用! 终于解决了,万分感谢呀~O(∩_∩)O~,我也学到了,昨天弄的:easyui datagrid使用combogrid作为编辑器示例 层的滑动效果js 求则表达式 禁止输入除数字以外的其它字符 这么获取DIV下 NAME标签 如何使用javascipt去掉滚动条 如何获取maxthon、TT这些浏览器名字 脚本问题:不关闭子窗口连续传值 json字符串解析 用window.open()打开的窗口的问题 控制TAB键除了TABINDEX外有其他方法吗 怎么设定jqueryui中的dialog返回值给input(输入框点击打开dialog,dialog中有一个按钮,点击返回值给输入框,并关闭) $.fn.extend() 和 $.extend() 的区别
这个方法我知道,但我是在列编辑器combogrid的选中事件中写的,直接用updateRow方法会报错。
这个方法我知道,但我是在列编辑器combogrid的选中事件中写的,直接用updateRow方法会报错。先调用endEdit结束编辑,在执行updateRow
这个方法我知道,但我是在列编辑器combogrid的选中事件中写的,直接用updateRow方法会报错。先调用endEdit结束编辑,在执行updateRow我把代码贴出来:var batchEditor = {
type : 'combogrid',
options : {
panelWidth:450,
idField:'BatchNo',
textField:'BatchNo',
fit: true,
fitColumns:true,
singleSelect: true,
required: true,
editable : false,
columns: [[
{ field: 'BatchNo', title: '批次号', width: 70, align: 'center', sortable: "true" },
{ field: 'LocationId', title: '库位ID', width: 70, align: 'center', sortable: "true" , hidden: "true"},
{ field: 'LocationName', title: '库位', width: 70, align: 'center', sortable: "true" },
{ field: 'CurrentAmount', title: '数量', width: 70, align: 'center', sortable: "true" },
{ field: 'Price', title: '价格', width: 70, align: 'center', sortable: "true" },
{ field: 'ManufactureDate', title: '生产日期', width: 80, align: 'center', sortable: "true" },
{ field: 'ValidityPeriod', title: '有效期', width: 80, align: 'center', sortable: "true" }
]],
onSelect:function(rowIndex, rowData) {
var drow = $('#detail').datagrid('getSelected');
var index = $('#detail').datagrid('getRowIndex',drow); $('#detail').datagrid('endEdit', index);
$('#detail').datagrid('updateRow',{index:index,row:{LocationId:rowData.LocationId,CurrentAmount:rowData.CurrentAmount} }
}
}
报这个错误:[
var dg = $(this);//dg为当前弹出的grid的引用
//var drow = $('#detail').datagrid('getSelected');
//var index = $('#detail').datagrid('getRowIndex', drow); //$('#detail').datagrid('endEdit', index);
dg.datagrid('updateRow', { index: rowIndex, row: { LocationId: rowData.LocationId, CurrentAmount: rowData.CurrentAmount} });
}
[
setTimeout(function () {
var drow = $('#detail').datagrid('getSelected');
var index = $('#detail').datagrid('getRowIndex', drow); $('#detail').datagrid('endEdit', index);
$('#detail').datagrid('updateRow', { index: index, row: { LocationId: rowData.LocationId, CurrentAmount: rowData.CurrentAmount} });
}, 100);
}
我试了下这个方法,好用! 终于解决了,万分感谢呀~
O(∩_∩)O~,我也学到了,昨天弄的:easyui datagrid使用combogrid作为编辑器示例