PHP?r=subprocess/subprocessInfo",editable:true,//开启编辑模式
clickToSelect: true,cache: false,showToggle:true,//
显示切换按钮来切换表/卡片视图。
showPaginationSwitch:true,//
显示分页切换按钮
pagination: true,pageList: [10,25,50,100],pageSize:10,pageNumber:1,uniqueId: 'index',//将index列设为唯一索引
striped: true,search: true,showRefresh: true,minimumCountColumns: 2,smartDisplay:true,columns: [
[
{field:"index",title:"ID",align:"center",edit:false,formatter:function(value,row,index){
return row.index=index ; //返回行号
}},{field:"actionName",title:"ActionName",order:"asc",sortable:"true",index){
var strHtml ='
';
return strHtml;
}},{field:"category",title:"Category",sortable:"true"},{field:"description",title:"Description",align:"center"},{field:"action",title:"Action",index){
var strHtml =''+
'
';
return strHtml;
},edit:false},{field:"actionId",title:"ActionID",visible:false,searchable:false}
]
]
});
/**
- add a new row
*/
$('#addData').click(function(){
$('#subprocessTable').bootstrapTable('selectPage',1); //Jump to the first page
var data = {actionId: '',actionName: '',category:'',description: ''}; //define a new row data,certainly it's empty
$('#subprocessTable').bootstrapTable('prepend',data); //the method of prepend must defined all fields,but append needn't
//$('#dataTable').bootstrapTable('append',data);
$("#dataTable tr:eq(1) td:eq(0)").trigger("dblclick");
$("#dataTable input")[0].focus();
});
});
PHP?r=dictionary/dictionaryInfo&type='+"run",//data:[{id:1,text:'hello'},{id:2,text:'hi'}],valueField:'id',textField:'text',editable : false,onSelect:function(val,rec){
//console.log(val,rec);
}
},sortable:true}
添加到列集合中
var col2 = {};
col2["field"] = "scenarioId";
col2["title"] = "haha";
col2["align"] = 'center';
col2["edit"] = false;
columnsAll.push(col2); //把这个对象
添加到列集合中
//表格数据
$('#detailTable').bootstrapTable({
method: 'get',url:"./index.
PHP?r=session/sessionInfo",columns: [
columnsAll
]
});
});