【若依系统-前后端不分离版本的】怎么在列表中直接修改某个字段的值

2023-09-22  本文已影响0人  唏嘘的码农

1:在header中引入css

<th:block th:include="include :: bootstrap-editable-css" />

2:在footer下面引入edittable的js

<th:block th:include="include :: bootstrap-table-editable-js" />

3:在options中启用onEditableSave属性

onEditableSave: onEditableSave,

4:在对应需要修改的字段中添加editable属性。

{

field:'remarks',

    title:'备注',

    editable : {

type :'text',

        title :'备注',

        placement:'left',//单元格右侧显示文本编辑

        emptytext :"-"

    }

},

5:修改保存时候触发的函数。

function onEditableSave (field, row, rowIndex, oldValue, $el) {

// alert("字段名:" + field + ",当前值:" + row[field]  + ",旧值:" + oldValue);

    var id = row.id;

    var remarks = row.remarks;

    var submitData = {

id: id,

        remarks:remarks

};

    $.operate.post(prefix +"/editRemarks", submitData);

    $.table.refresh();

}

https://cloud.tencent.com/developer/article/2194157?areaSource=102001.8&traceId=rlzTkBeMt3LlZwVXYi1G5

上一篇 下一篇

猜你喜欢

热点阅读