当动态设置页面大小和页面大小选项时,jQxgrid会覆盖焦点

时间:2017-10-31 18:31:16

标签: jquery jqgrid jqxgrid

var sUSR_DisplRows = 'number that comes from DB';
var iNum = parseInt(sUSR_DisplRows);
var count = 0; //because each grid will trigger the event
    jQ("#onegrid, #twogrid, #threegrid").on("bindingcomplete", function (event) {
       if(count == 2){
           CustomScript.reshape(sUSR_DisplRows, iNum);
       }
       count ++;
    });
}

function reshape(sUSR_DisplRows, iNum){
    //here I set the page size base on the user saved number
    jQ('#onegrid').jqxGrid({ pagesize: iNum});
    jQ('#twogrid').jqxGrid({ pagesize: iNum});
    jQ('#threegrid').jqxGrid({ pagesize: iNum});
    if(sUSR_DisplRows < 10){
        jQ('#onegrid').jqxGrid({ pagesizeoptions: [sUSR_DisplRows, '10', '20']});
        jQ('#twogrid').jqxGrid({ pagesizeoptions: [sUSR_DisplRows, '10', '20']});
        jQ('#threegrid').jqxGrid({ pagesizeoptions: [sUSR_DisplRows, '10', '20']});
    }else if(sUSR_DisplRows >= 10 & sUSR_DisplRows < 20){
        jQ('#onegrid').jqxGrid({ pagesizeoptions: ['5', sUSR_DisplRows, '20']});
        jQ('#twogrid').jqxGrid({ pagesizeoptions: ['5', sUSR_DisplRows, '20']});
        jQ('#threegrid').jqxGrid({ pagesizeoptions: ['5', sUSR_DisplRows, '20']});
    }else{
        jQ('#onegrid').jqxGrid({ pagesizeoptions: ['5', '10', sUSR_DisplRows]});
        jQ('#twogrid').jqxGrid({ pagesizeoptions: ['5', '10', sUSR_DisplRows]});
        jQ('#threegrid').jqxGrid({ pagesizeoptions: ['5', '10', sUSR_DisplRows]});
    }
}

问题在于,当我设置页面选项时,页面将集中在网格分区上。 我需要覆盖或消除此行为

1 个答案:

答案 0 :(得分:0)

您是否尝试过设置pagesizeoptions或pagesize以调用Grid的焦点方法来聚焦它或使用$(“#myJQ”)。focus()语法?