easyui datagrid 查询出行可以直接编辑

easyui datagrid 查询出行可以直接编辑

问题描述:

img

img

img

这个是代码截图,值已经拿到了,却不太明白应该怎么启用datagrid 编辑,刚接触前台,求指点。

使用beginEdit方法启动编辑,要对每列进行格式处理,加入对应控件。参考:

$('#dgitem').datagrid('selectRow', rowIndex);
$('#dgitem').datagrid('beginEdit', rowIndex);

datagrid有beginEdit方法,调用后

beginEdit index    Begin editing a row.

获取combobox编辑器,在设置combobox数据源


getEditor    options    Get the specified editor, the options contains two properties:
index: the row index.
field: the field name.
Code example:

// get the datebox editor and change its value
var ed = $('#dg').datagrid('getEditor', {index:1,field:'birthday'});
$(ed.target).datebox('setValue', '5/4/2012');

combobox调用loadData加载数据


loadData    data    Load the locale list data.

建议题主先研究下easyUI的api:


有帮助麻烦点个采纳【本回答右上角】,谢谢~~