【问题标题】:jqGrid - disable page size dropdownjqGrid - 禁用页面大小下拉
【发布时间】:2012-10-19 09:01:30
【问题描述】:

我想禁用分页,但想保留左侧的加号按钮。下面的图片是我最终得到的。仍然有一个下拉页面大小可见。我已经为此取消了分页选项。不过还是……

这里是代码

jQuery("#detFlex101_1").jqGrid({
    url: root + mod + '/detaillistview',
    datatype: "local",
    colNames:[' ', '@Resources.Xdt_Parameter.param_display_name', '@Resources.Xdt_Parameter.param_tooltip_desc', '@Resources.Xdt_Parameter.param_data_type', ' ', ' ', '@Resources.Xdt_QueryParameter.qupa_required_flag', '@Resources.Xdt_QueryParameter.qupa_default_value'],
    colModel:[
        {name:'myac', width:80, fixed:true, sortable:false, resize:false, formatter:'actions', formatoptions:{keys:true, editbutton : false, delbutton : false, delOptions: {reloadAfterSubmit:false},editOptions: {reloadAfterSubmit:false}}},
        {name:'display_name',index:'display_name', width:100},
        {name:'tooltip_description',index:'tooltip_description', width:300},
        {name:'data_type',index:'data_type', width:100},
        {name:'parameter_id',index:'parameter_id', width:100,hidden:true},
        {name:'query_id',index:'query_id', width:100,hidden:true},
        {name:'required_flag',index:'required_flag', width:100},
        {name:'default_value',index:'default_value', width:100}
        ],
    width: $('.body').width()-40,
    height: 120,

    pager: '#pagerFlex101_1',
    rowList: [],        // disable page size dropdown
    pgbuttons: false,     // disable page control like next, back button
    pgtext: null,         // disable pager text like 'Page 0 of 10'
    viewrecords: false,   // disable current view record text like 'View 1-10 of 100'

    sortname: 'parameter_id',
    sortorder: "desc",
    editurl: root + mod + '/detailpost',
    caption:"@Resources.Xdt_QueryParameter.qupa_param_title",
    onSelectRow: function(id){
        activedf = "#detFlex101_1";
    },
    afterInsertRow: function () {
        var grid = $(this),
        iCol = getColumnIndexByName(grid,'myac'); // 'act' - name of the actions column
        grid.find(">tbody>tr.jqgrow>td:nth-child(" + (iCol + 1) + ")")
        .each(function() {
            if ($(this).find(">div>div").length == 2)
            {
                $("<div>",
                    {
                        title: "Delete",
                        mouseover: function() {
                            $(this).addClass('ui-state-hover');
                        },
                        mouseout: function() {
                            $(this).removeClass('ui-state-hover');
                        },
                        click: function(e) {
                            df_delete_1($(e.target).closest("tr.jqgrow").attr("id"));
                        }
                    }
                  ).css({float:"left"})
                   .addClass("ui-pg-div ui-inline-edit")
                   .append('<span class="ui-icon ui-icon-trash"></span>')
                   .prependTo($(this).children("div"));

                $("<div>",
                    {
                        title: "Edit",
                        mouseover: function() {
                            $(this).addClass('ui-state-hover');
                        },
                        mouseout: function() {
                            $(this).removeClass('ui-state-hover');
                        },
                        click: function(e) {
                            df_edit_1($(e.target).closest("tr.jqgrow").attr("id"));
                        }
                    }
                  ).css({float:"left"})
                   .addClass("ui-pg-div ui-inline-edit")
                   .append('<span class="ui-icon ui-icon-pencil"></span>')
                   .prependTo($(this).children("div"));

                $("<div>",
                    {
                        title: "Up",
                        mouseover: function() {
                            $(this).addClass('ui-state-hover');
                        },
                        mouseout: function() {
                            $(this).removeClass('ui-state-hover');
                        },
                        click: function(e) {
                            jqGridMoveRow('up', grid, $(e.target).closest("tr.jqgrow").attr("id"));
                        }
                    }
                  ).css({float:"left"})
                   .addClass("ui-pg-div ui-inline-edit")
                   .append('<span class="ui-icon ui-icon-arrowthick-1-n"></span>')
                   .prependTo($(this).children("div"));

                $("<div>",
                    {
                        title: "Down",
                        mouseover: function() {
                            $(this).addClass('ui-state-hover');
                        },
                        mouseout: function() {
                            $(this).removeClass('ui-state-hover');
                        },
                        click: function(e) {
                            jqGridMoveRow('down', grid, $(e.target).closest("tr.jqgrow").attr("id"));
                        }
                    }
                  ).css({float:"left"})
                   .addClass("ui-pg-div ui-inline-edit")
                   .append('<span class="ui-icon ui-icon-arrowthick-1-s"></span>')
                   .prependTo($(this).children("div"));
            }
        });
    }
});

jQuery("#detFlex101_1").jqGrid('navGrid','#pagerFlex101_1',{edit:false,del:false,search:false, addfunc: df_add_1});
jQuery("#detFlex101_1").jqGrid('gridResize', {minWidth:350, maxWidth:1920, minHeight:80, maxHeight:1080} );
jQuery("#detFlex101_1").jqGrid({pgbuttons:false, recordtext:'', pgtext:''});

有人知道该怎么做吗?

【问题讨论】:

标签: jquery jqgrid jqgrid-asp.net


【解决方案1】:

虚拟滚动(scroll: 1)的用法和不分页不一样。

如果您只需要有空寻呼机,则需要使用一些 jqGrid 选项(请参阅the documentation):

rowNum: 10000,      // !!! it's important to increase default 20 value
pginput: false,
pgbuttons: false,
rowList: [],        // it's default setting
viewrecords: false, // it's also default setting

最重要的是不要忘记用足够大的值定义rowNum。如果您不这样做,那么网格中只会显示第一页的 20 行。

【讨论】:

    【解决方案2】:


    您可以使用滚动选项,在 jqgrid 选项中定义它。
    scroll:1
    通过使用此选项,您将指示 jqgrid 不使用分页,换句话说,您将实现虚拟滚动。
    希望它满足您的需求.

    【讨论】:

      【解决方案3】:

      只需要像下面这样设置网格选项 行数:1000, 行列表:[], pgbuttons:假, pgtext:“”, pginput:假, 查看记录:假,

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-09-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-03-24
        • 2019-01-01
        • 2014-04-29
        相关资源
        最近更新 更多