继续送福利了,居于Bootstrap可编辑表格,编辑框支持下拉和日期,先上图看下效果,如图1:
这是居于bootstrap-table进行扩展的功能,bootstrap-table的使用这边就不多说了,日期控件用的是bootstrap-datetimepicker,下拉控件bootstrap-select 这个是小编自己写的
bootstrap-table API地址:http://www.html580.com/11556/demo
bootstrap-datetimepicker API地址:http://www.bootcss.com/p/bootstrap-datetimepicker/
bootstrap-select API地址:http://blog.csdn.net/lzxadsl/article/details/48859625
$('#j-installment_table').bootstrapTable({
method:'get',
url: 'xxx.htm',
striped: true,
clickToSelect: true,
pagination: true,
pageSize: 10,
sidePagination:'server',
pageList: [10, 20, 50, 100, 200, 500],
queryParamsType: 'limit',
queryParams: function (params){
//获取查询条件
$('#j_serach').getSearchParams(params);
return params;
},
columns: [
{field:'',title:'复选框',width:50,checkbox:true},
{field:'order_type',title:'订单类型',align:'center'},
{field:'status',title:'状态',align:'center'},
{field:'CarTrunk',title:'车辆轨迹',align:'center',formatter:function(value,row,rowIndex){
var strHtml = '修改';
if(row.status == '新建'){
strHtml += ' 审核';
}
return strHtml;
}}
]
});
$('#reportTable1').bootstrapTable({
method: 'get',
editable:true,//开启编辑模式
clickToSelect: true,
columns: [
{field:"user_email",edit:false,title:"email",align:"center"},
{field:"user_company",edit:{
type:'select',//下拉框,如果是下拉则需要设置type为select
//url:'user/getUser.htm',//从服务器加载
data:[{id:1,text:'lzx'},{id:2,text:'lsl'}],
valueField:'id',
textField:'text',
onSelect:function(val,rec){
console.log(val,rec);
}
},title:"company",align:"center",width:"200px"},
{field:"user_dates",edit:{
type:'date'//日期
},title:"date",align:"center"},
{field:"user_version",title:"version",align:"center",
edit:{
required:true,
click:function(){
}
}
},
{field:"user_isv2",title:"isv2",align:"center"},
{field:"userstatus_usertype",title:"usertype",align:"center"},
{field:"userstatus_package_id",title:"package_id",align:"center"},
{field:"userstatus_end_time",title:"end_time",align:"center",formatter:function(value,row,rowIndex){
var strHtml = '删除';
return strHtml;
},edit:false},
{field:"user_lastlogintime",title:"lastlogintime",align:"center",valign:'middle'}
],
data : []
});
$('.form_datetime').datetimepicker({
weekStart: 1,
todayBtn: 1,
autoclose: 1,
todayHighlight: 1,
startView: 2,
forceParse: 0,
language:'zh-CN',
format: 'yyyy-mm-dd hh:ii:ss',
pickerPosition: 'bottom-left',
showMeridian: 1
});