JqGrid多次加载问题

  1. 解决

$(function () {
    // 初始化调用
    $("#jqGrid").jqGrid({
        url: '/admin/shops/list',
        datatype: "json",
        postData : {
            passStatus : ''
        },
        colModel: [
            {label: 'id', name: 'id', index: 'id', width: 50, key: true, hidden: true},
            {label: '店铺名称', name: 'shopName', index: 'shopName', width: 150},
            {label: 'logo', name: 'shopImg', index: 'shopImg', width: 100},
            {label: '营业执照', name: 'shopIdcard', index: 'shopIdcard', width: 100},
            {label: '是否禁用', name: 'lockedFlag', index: 'lockedFlag', width: 60, formatter: lockedFormatter},
            {label: '是否注销', name: 'isDeleted', index: 'isDeleted', width: 60, formatter: deletedFormatter},
            {label: '审核状态', name: 'passStatus', index: 'passStatus', width: 60, formatter: deletedFormatter},
            {label: '审核人员', name: 'passAdmin', index: 'passAdmin', width: 60},
            {label: '注册时间', name: 'createTime', index: 'createTime', width: 120}
        ],
        height: 560,
        rowNum: 10,
        rowList: [10, 20, 50],
        styleUI: 'Bootstrap',
        loadtext: '信息读取中...',
        rownumbers: false,
        rownumWidth: 20,
        autowidth: true,
        multiselect: true,
        pager: "#jqGridPager",
        jsonReader: {
            root: "data.records",
            page: "data.current",
            total: "data.pages",
            records: "data.total"
        },
        prmNames: {
            page: "page",
            rows: "limit",
            order: "order",
        },
        gridComplete: function () {
            //隐藏grid底部滚动条
            $("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
        }
    });

    // 这个是下拉选择改变事件
    $('#passStatus').on('changed.bs.select',function(e){
        let passstatue = $("#passStatus").val()
        console.log("->",passstatue)
        $("#jqGrid").jqGrid("setGridParam", { postData: {  passStatus : passstatue } }).trigger("reloadGrid")
    });


    $(window).resize(function () {
        $("#jqGrid").setGridWidth($(".card-body").width());
    });

});

解决

在其他事件中 主要是加入这句 重新加载网格 即可

$(``"#list4"``).jqGrid(``"setGridParam"``, { postData: { id: id } }).trigger(``"reloadGrid"``)


日夜颠倒头发少 ,单纯好骗恋爱脑 ,会背九九乘法表 ,下雨只会往家跑 ,搭讪只会说你好 ---- 2050781802@qq.com

×

喜欢就点赞,疼爱就打赏

相册 说点什么