加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Bootstrap分页查询

发布时间:2020-12-17 21:19:39 所属栏目:安全 来源:网络整理
导读:前台方法: function show() { $( ‘#reportTable‘ ).bootstrapTable({ method: ‘get‘ ,url: "@Url.Action("GetList","UserInfoFun")" ,pagination: true , // 分页 striped: false ,pageSize: 10 ,pageNumber: 1 ,minimumCountColumns: 1 ,queryParamsTy

前台方法:

   function show() {
            $(‘#reportTable‘).bootstrapTable({
                method: ‘get‘,url: "@Url.Action("GetList","UserInfoFun")",pagination: true,//分页
                striped: false,pageSize: 10,pageNumber: 1,minimumCountColumns: 1,queryParamsType: ‘count‘,sidePagination: ‘server‘,dataType: ‘json‘,contentType: ‘application/json‘,idField: ‘S_CASEID‘,queryParams: getQueryParams
            });
        }

?

 function getQueryParams(queryParams) {
            var options = $("#reportTable").bootstrapTable(‘getOptions‘);
            $.extend(options,queryParams);
            var sortOrder = options.sortOrder == "desc" ? " asc" : " desc";
            var sortName = options.sortName || "s_id";
            var temp = $("#fm_doc").serializeJsonObject();
            temp["pageIndex"] = (options.pageNumber - 1) * options.pageSize;
            temp["pageSize"] = options.pageSize;
            temp["sort"] = sortName + sortOrder;
           return temp;
        }

?

  function formatterOperation(value,row,index) {
            var str = "";
            str += "<a href="javascript:void(0)" onclick="Edit(‘" + row["Id"] + "‘)"><span class=‘glyphicon glyphicon-pencil‘></span>编辑</a>&nbsp;&nbsp;";
            str += "<a href="javascript:void(0)" onclick="Delete(‘" + row["Id"] + "‘)"><span class=‘glyphicon glyphicon-remove‘></span>删除</a>";
            return str;
        }
  function Delete(id) {
            if (confirm("确认要删除用户吗?")) {
                $.ajax({
                    url: "@Url.Action("Delete",type: "post",data: { id: id },dataType: "json",success: function (d) {
                        if (d.Success) {
                            alert("删除成功");
                            //doSearchByButton();
                        }
                        else {
                            alert(d.ErrorMsg);
                        }
                    }
                });
            }
        }
  function Edit(id) {
            TopLayerInfo(‘编辑用户‘,‘@Url.Action("AddUser","UserInfo")?IsAdd=false&id=‘ + id + ‘‘,‘55%‘,‘50%‘);
        }

?

前台Html:

 <div class="base-table" id="tabDiv" style="height:600px;margin-left:10px">
                <table id="reportTable" class="table baseTHead">
                    <thead>
                        <tr>
                            <th data-field="Id">用户帐号</th>
                            <th data-field="Name">姓名</th>
                            <th data-field="Policeinfo_Id">年龄</th>
                            <th data-formatter="formatterOperation" data-align="center" data-width="120px">操作</th>
                        </tr>
                    </thead>
                </table>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读