jqgrid catch重载网格,不是每个ajax加载

时间:2013-05-30 16:38:17

标签: jqgrid

我正在尝试捕捉网格重新加载的时刻( grid.trigger('reloadGrid')),以便我可以将其滚动到所需的位置。目前发生的事情是当我向下滚动它时会在每个ajax调用上触发事件(比如加载更多行)。 我尝试过使用不同的事件,哪一个是正确的? 代码是简单的初始化,这里没什么特别的

jQuery("#filtergrid").jqGrid({
            scroll:true,
            scrollrows:true,
            datatype: 'json',
            url: '/bo/filter/index.php?func=get-list',
            mtype: 'POST',
            colNames:[
            'ID',
            'Title',
            'Domain',
            'Random',
            'Men',
            'Women',
            'Snails',
            'Min Age',
            'Max Age',
            'Read Days',
            'Click Days',
            'Join Days',
            'Master',
            '<img src="/assets/duplicate.gif">'
            ],
            colModel :[ 
                {name:'flt_id', index:'flt_id', width:50, key:true, search: false, key: true, fixed: true}, 
                {name:'flt_title', index:'flt_title', width:215, fixed: true, formatter: formatName}, 
                {name:'dmn_name', index:'dmn_name', width:220, fixed: true}, 
                {name:'is_random', index:'is_random', search: false, width:50, fixed: true, formatter: stsFormatter, align: 'center', sortable: false}, 
                {name:'is_man', index:'is_man', search: false, width:50, fixed: true, formatter: stsFormatter, align: 'center', sortable: false}, 
                {name:'is_woman', index:'is_woman', search: false, width:50, fixed: true, formatter: stsFormatter, align: 'center', sortable: false}, 
                {name:'is_snals', index:'is_snals', search: false, width:50, fixed: true, formatter: stsFormatter, align: 'center', sortable: false}, 
                {name:'min_age', index:'min_age', search: false, width:53, fixed: true, align: 'center', sortable: false}, 
                {name:'max_age', index:'max_age', search: false, width:58, fixed: true, align: 'center', sortable: false}, 
                {name:'read_days', index:'read_days', width:60, fixed: true, search: false, formatter: numFormatter, align: 'center', sortable: false}, 
                {name:'click_days', index:'click_days', width: 60, fixed: true, search: false, formatter: numFormatter, align: 'center', sortable: false}, 
                {name:'join_days', index:'join_days', width:58, fixed: true, search: false, formatter: numFormatter, align: 'center', sortable: false},
                {name:'flt_master', index:'flt_master', width:50, fixed: true, search: false, formatter: stsMasterFormatter, align: 'center', sortable: false},
                {name:'editlink', index:'editlink', width:20, fixed: true, formatter: formatEditImg, search: false}
            ],
            lastSel: null,
            pager: '#pager',
            rowNum: 150,
            rowList: [150],
            sortname: 'dmn_name',
            height: 320,
            autowidth:false,
            gridview: true,
            sortorder: 'asc',
            viewrecords: true,
            caption: 'Filters',
            footerrow : false,
            userDataOnFooter : false, 
            altRows : true,
            //postData : '',    
            multipleSearch:true,
            jsonReader : { repeatitems: false },
            pager: '#pager',
            width: 1130,        //shrinkToFit: true
            gridComplete: function(){
                jQuery("#filtergrid").closest(".ui-jqgrid-bdiv").scrollTop(scrollPosition)
            }
        });

谢谢!

1 个答案:

答案 0 :(得分:1)

而不是gridComplete使用loadComplete。查看此线程以了解这两个事件之间的差异 Grid Complete vs Load Complete