bootstrapTable 动态表头生成

jsp

class="col-xs-12 table-waper"> id="table_task" class="table table-bordered table-configure">

js


function getdatafrom() {
    debugger;
    var groupId = $("#groupId").val();
    var taskNumber=$.trim($("#taskNumber").val());
    var haveValus=$("#haveValus").val();
    var formID=$("#formID").val();
    var moduleID=$("#moduleId").val();
    var status= $("#status").val();
    var remarks= $("#remarks").val();
    var type= $("#type").val();
    var pages=$.trim($("#pages").val());
    var pageNumber=$.trim($("#pageNumber").val());
    if (pages==null||pages==''){
        pages=1;
    }
    if (pageNumber==null||pageNumber==''){
        pageNumber=20;
    }
    if (type==null||type==''){
        type="1";
    }
    if (status==null||status==''){
        status=1;
    }
    var regu = /^[1-9]\d*$/;
    //var regu = /^([1-9][0-9]*){1,3}$/; 亲测可用
    //var regu = /^\+?[1-9][0-9]*$/; 亲测可用
    if (pages != "") {
        if (!regu.test(pages)) {
            alert('页码数请输入正整数!');
            return false;
        }
    }
    console.log(CONTEXT_PATH);
    //debugger;
    $.ajax({
        type: "post",
        url: CONTEXT_PATH+"/collectionData/queryCollectionDataList.do",
        async: true,
        dataType: "json",
        data: {
            page:pages,
            rows:pageNumber,
            groupId:groupId,
            taskNumber:taskNumber,
            haveValus:haveValus,
            type:type,
            formID:formID,
            moduleID:moduleID,
            status:status

        },
        success: function (data) {
            console.log(data.result);
            if(data.result.formData=='[]'){
                alert("暂无数据");
            }
            var formdata='[{"number":1,"title":"4403070060020100016000007","groupNames":"龙岗区-龙岗街道-龙岗社区-龙岗01","status":"未完成"},{"number":2,"title":"4403070060020100016000008","groupNames":"龙岗区-龙岗街道-龙岗社区-龙岗01","status":"未完成"}]';
            var msg = JSON.parse(data.result.formDataTitle);
            var formData = JSON.parse(formdata);
            $("#table_task").bootstrapTable({
                columns: [msg]   ,//动态取标题
                data:formData
            });
        }
    });
}
 
  
 
  
 
  
 
  
 ok 
  

你可能感兴趣的:(java技术)