当前位置: 移动技术网 > IT编程>开发语言>JavaScript > bootstrap table 数据表格行内修改的实现代码

bootstrap table 数据表格行内修改的实现代码

2019年03月25日  | 移动技术网IT编程  | 我要评论

js中设置列的属性 editable :

{
type : 'text',//数据显示在文本框内
emptytext : "--",//数据为空时显示
validate : function(value) {
if ($.trim(value) == '') {
return '不能为空';//修改是数据为空 显示
}
}
}

js中设置bootstrop-table加载数据时属性

oneditablesave : function(field, row, oldvalue, $el) {
$('#id').bootstraptable('resetview');
row = datawarp(row, field);// 编辑时重新包装数据 可写可不写
$.ajax({
type : "post",
url : 路径,
data : row,//行内修改后的数据
datatype : 'json',
success : function(data, status) {
if (status == "success") {
modal.alert({
msg : "编辑成功!"
});
}
},
error : function() {
modal.alert({
msg : "编辑失败!"
});
$('#id').bootstraptable('refresh');// 数据加载成功后刷新
},
complete : function() {
}
});
}

以上所述是小编给大家介绍的bootstrap table 数据表格行内修改的实现代码,希望对大家有所帮助

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网