开发中遇到的需求为:导出excel时,可根据需要导出特定的字段内容
//先获取所有字段,然后遍历,visible为true的为显示的字段,反之是隐藏的字段,下面例子是所有字段,可根据需求筛选
var tableData = $('#bootstraptable').bootstrapTable('getOptions').columns[0];
var arrrayTable = [];
for ( var i = 0; i < columntotal; i++ ){
var field = tableData[i].field;
var fieldIndex = tableData[i].fieldIndex;
var visible = tableData[i].visible;
var title = tableData[i].title;
var sortable = tableData[i].sortable;
var align = tableData[i].align;
var valign = tableData[i].valign;
var formatter = tableData[i].formatter;
arrrayTable.push({"field":field,"fieldIndex":fieldIndex,"visible":visible,"title":title,"sortable":sortable,"align":align,"valign":valign,"formatter":formatter})
}
return arrrayTable;
};