温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

bootstrapTable

发布时间:2020-08-02 18:29:14 阅读:1149 作者:fenghq_hs 栏目:开发技术
开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>
<div class="container">
    <div id="toolbar">
        <button id="remove" class="btn btn-danger" disabled>
            <i class="glyphicon glyphicon-remove"></i> Delete
        </button>
    </div>
    <table id="mytable">
        <thead>
            <tr>
                <th data-field="rowid" data-checkbox="true"></th>
                <th data-field="Name" data-editable="true">部门名称</th>
                <th data-field="ParentName">上级部门</th>
                <th data-field="Level" data-editable="true">部门级别</th>
                <th data-field="Desc" data-editable="true">描述</th>
            </tr>
        </thead>
    </table>
</div>
<link rel="stylesheet" href="common/bootstrap-table/bootstrap-table.css">
<link rel="stylesheet" href="common/bootstrap-table/bootstrap-editable.css">
<script type="text/javascript" src="common/bootstrap-table/bootstrap-table.js"></script>
<script type="text/javascript" src="common/bootstrap-table/bootstrap-editable.js"></script>
<script type="text/javascript" src="common/bootstrap-table/bootstrap-table-zh-CN.min.js"></script>
<script>
    $('#mytable').bootstrapTable({
        url'test_table',         //请求后台的URL(*)
        dataField"rows",//服务端返回数据键值 就是说记录放的键值是rows,分页时使用总记录数的键值为total
        cachefalse,//是否使用缓存,默认为true
        searchtrue,//是否搜索
        paginationtrue,//是否分页
        pageSize5,//单页记录数
        pageNumber1,//初始化加载第一页,默认第一页
        pageList: [5102050],//分页步进值
        sidePagination"server",//分页方式:client客户端分页,server服务端分页
        paginationFirstText"首页",
        paginationPreText"上一页",
        paginationNextText"下一页",
        paginationLastText"末页",
        clickToSelecttrue,//是否启用点击选中行
        dataType"json",//期待返回数据类型
        method"get",//请求方式
        searchAlign"left",//查询框对齐方式
        locale"zh-CN",//中文支持,
        detailViewtrue//是否显示详情折叠
        detailFormatterfunction(index, row, element) {
                var html = '';
                $.each(row, function(key, val){
                    html += "<p>" + key + ":" + val +  "</p>"
                });
                return html;
        },
        queryParamsType"limit",//查询参数组织方式
        queryParamsfunction getParams(params) {
                //自定义传递参数
                params.other = "otherInfo";
                return params;
            },
        searchOnEnterKeyfalse,//回车搜索
        showRefreshtrue,//刷新按钮
        showColumnstrue,//列选择按钮
        buttonsAlign"left",//按钮对齐方式
        toolbar"#toolbar",//指定工具栏
        toolbarAlign"right",//工具栏对齐方式
        columns: [
            {
                field"rowid",
                title"全选",
                checkboxtrue,
            },
            {
                field'Name',
                title'部门名称',
                editable:true
            }, {
                field'ParentName',
                title'上级部门'
            }, {
                field'Level',
                title'部门级别'
            }, {
                field'Desc',
                title'描述'
            },
        ]
    });
</script>

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI

开发者交流群×