|
Title: how could the datagrid refresh Row when i click line-editing Post by: 20051289 on July 12, 2012, 08:23:39 AM please check my code:
Code: $('#department').datagrid( Is that right?{ title : '', iconCls : 'icon-edit', width : 600, height : 350, nowrap : false, pageList : [ 10, 20, 30 ], striped : true, collapsible : true, url : 'DepartmentAction!List.action', sortOrder : 'desc', remoteSort : false, idField : 'did', method : 'post', singleSelect : true, frozenColumns : [ [ { field : 'ck', checkbox : true } ] ], columns : [ [ { field : 'dname', title : '区县名称', width : 200, align : 'center', editor : 'text' }, { field : 'dsort', title : '排列顺序', width : 100, align : 'center', editor : 'numberbox' }, { field : 'operator', title : '操作列', width : 200, align : 'center', formatter : function(value, row, index) { if (row.editing) { var s = '<a href="javascript:void(0);" onclick="saverow(' + index + ')">save</a>'; var c = '<a href="javascript:void(0);" onclick="cancelrow(' + index + ')" >can</a>'; return s + c; } else { var e = '<a href="javascript:void(0);" onclick="editrow(' + index + ')" style="text-decoration: none;color: #800080;">edit</a> '; var d = '<a href="javascript:void(0);" onclick="deleterow(' + index + ')" style="text-decoration: none;color: #800080;">del</a>'; return e + d; } } } ] ], onBeforeEdit : function(index, row) { row.editing = true; alert(row.editing); $('#department').datagrid('refreshRow', index); count++; }, onAfterEdit : function(index, row) { row.editing = false; $('#department').datagrid('refreshRow', index); count--; }, onCancelEdit : function(index, row) { row.editing = false; $('#department').datagrid('refreshRow', index); count--; }, pagination : true, rownumbers : true, }); }); function cancelrow(index) { $('#department').datagrid('cancelEdit', index); } but when i click 'eidt',the 'action' is "edit" and "del",it should be "save" and "can".. |