$('#labelName').bootstrapTable({
pagination : false,//是否分页
columns: [
{
field: 'label',
title: '标签名称'
},
{
field: 'key',
title: '主键选择',
editable: {
type: 'select',
title: '主键选择',
mode: "inline",
width: 150,
source: function(row){
var result = [];
// 1获取list的时候就把数据拼接好,减少页面请求
var getData = $('#labelName').bootstrapTable('getData'),
index = $(this).parents('tr').data('index');
console.log(getData[index].data)
$.each(getData[index].data, function (key,value) {
result.push({ value:value, text:value });
});
//2.通过后台发请求获取
$.ajax({
url:aicKnowledge + 'update/getProperties',
async: false,
type: "get",
data: {
id:jumpId,
label:getData[index].label
},
success: function (datas, status) {
if(datas.code == 600){
var items = datas.data;
$.each(items, function (key,value) {
result.push({ value:value, text:value });
});
}
}
});
return result;
},
noeditFormatter: function (value, row, index) { // 解决展示为empty的问题
var process={filed:"key",value:value};
return ['<a href="javascript:void(0)" rel="external nofollow" rel="external nofollow" rel="external nofollow" ',
' data-name="'+process.filed+'"',
' data-pk="1"',
' data-value="' + process.value + '"',
'>' + process.value + '</a>'
].join('');;
}
}
}
],
}