使用easyui实现双击列表中某个值直接对其进行修改

var editCell = undefined;
$('#dg').datagrid({
  url:'DwzServlet',
  iconCls:'icon icon-list' ,
  queryParams:{action:"list_member"},
  fitColumns:true,
  fit:true,
  loadMsg:'处理中,请稍候……',
  columns:[[
    {field:'F_GUID',title:'选择',checkbox:true,width:150,align:'center'},
    {field:'F_USERNAME',title:'成员名称',width:120,align:'left'},
    {field:'F_SEQUENCE',title:'成员顺序号',width:60,align:'center',editor:'numberbox'},
    {field:'F_SSJG',title:'上级机构',width:60,align:'center'}
  ]],
  onAfterEdit: function (rowIndex, rowData, changes) {
    $.post("DwzServlet",{action:'edit',guid:rowData.F_GUID,xh:rowData.F_SEQUENCE},function(str){
    editCell = undefined;
    });
  },
  onDblClickCell:function (rowIndex, field, value) {
    if (editCell != undefined) {
    $("#dg").datagrid('endEdit', editCell);
    }
    if (editCell == undefined) {
    $("#dg").datagrid('beginEdit', rowIndex);
    editCell = rowIndex;
    }
  },
  onClickRow:function(rowIndex,rowData){
    if (editCell != undefined) {
    $("#dg").datagrid('endEdit', editCell);
    }
  }
});
将要修改的值传到后台后,正常进行修改操作即可.

posted @ 2016-02-24 15:06  NA-CODE  阅读(1396)  评论(0编辑  收藏  举报