这一篇我们将对datagrid editor属性来进行详解
功能:1.点击添加,在首行上面添加一行,2.双击时编辑一行,3.删除选中所有行数,
就以以上三个功能的实现做解释
1.写在editor()中的url加参数不可行,因为初使化datagrid与其combotree时就已定死,所以改为更合理的方式
center_datagrid=$('#center_datagrid').datagrid({ url://获取数据 columns:[[ {field:'cid',title:'id',width:50,hidden:false,align:'center',checkbox:true}, {field:'cname',title:'角色',width:90,align:'center',editor:{type:'validatebox',options:{required:true}}}, {field:'cdesc',title:'描述',width:200,align:'center',editor:{type:'validatebox'}}, {field:'authId',title:'权限id',width:50,hidden:true,align:'center'}, {field:'authName',title:'权限',width:450,align:'center', editor:{type:'combotree',options:{multiple:true,checkbox:true,lines:true,onClick:function(node){ //editorValue=$(editorT.target).combotree('getChecked');//三种状态值,默认为'checked' //$(editorT.target).combotree('setValues',editorValue); }} }}]], toolbar:[{ text:'添加', iconCls:'icon-add', handler:function(){ //alert("add"); add(); } },'-',{ text:'删除', iconCls:'icon-remove', handler:function(){ remove(); } },'-',{ text:'编辑', iconCls:'icon-edit', handler:function(){ edit(); } },'-',{ text:'取消编辑', iconCls:'icon-cancel', handler:function(){ } },'-',{ text:'保存', iconCls:'icon-save', handler:function(){ save(); } }], onDblClickRow:function(rowIndex,rowData){ },onBeforeEdi