今天得到个需求,想要在列表页上直接修改数据。修改完的数据直接入库。
后端:java 前端:miniUI
前端开发:
在class="mini-datagrid" 的div内加入
allowCellEdit="true" allowCellSelect="true" multiSelect="true" editNextOnEnterKey="true" editNextRowCell="true" cellEditAction="celldblclick"
js开发:
注:updateUrl地址为java后端修改方法
saveToUp: function (thist,id) {
var row=proPlanGrid.getSelected();
console.log(row.id);
console.log(thist._oldValue);
var data = {
"id": row.id,
"numeric": thist._oldValue
}
$.ajax({
url: updateUrl,
data: data,
type: 'POST',
success: function (result) {
layer.closeAll('loading');
if (result.isSuccess) {
layer.msg('保存成功');
} else {
layer.msg(result.message)
}
}, error: function (result) {
layer.closeAll('loading');
var errorResult = $.parseJSON(result.responseText);
layer.msg(errorResult.collection.error.message);
}
})
}