jqGrid horizontal scrollbar

前端 未结 13 2157
终归单人心
终归单人心 2020-12-13 09:28

I developed AJAX interface with jQuery and jqGrid.

How I can remove horizontal scrollbar from my jqGrid table?

http://dskarataev.ru/jqgrid.png

If I s

13条回答
  •  渐次进展
    2020-12-13 09:55

    Here is how I did it and so far, so good. Basically, we resize the grid to accommodate the vertical scroll bar and by resizing, there is no horizontal overflow and therefore, the horizontal bar never shows up. Our cell sizing remains the same and the last cell is not partially hidden.

    loadComplete: function (data) {
                    //set our "ALL" select option to the actual number of found records
                    $(".ui-pg-selbox option[value='ALL']").val(data.records);
                    if ($(".ui-jqgrid").height() > $('#grid').getGridParam('maxHeight')) {
                        //resize our grid for the vertical scroll bar to eliminate the hortizontal scroll bar
                        $(".ui-jqgrid").css("width", $('#grid').getGridParam('width') + 20);
                        $(".ui-jqgrid-bdiv").css("width", $('#grid').getGridParam('width') + 17);
                        $(".ui-jqgrid-hdiv").css("width", $('#grid').getGridParam('width') + 20);
                        $(".ui-jqgrid-view").css("width", $('#grid').getGridParam('width') + 20);
                        $("#pager").css("width", $('#grid').getGridParam('width') + 20);
                        $(".ui-jqgrid-hbox").css("padding-right", "16px");
                    } else { //set everything to defaults
                        $(".ui-jqgrid").css("width", $('#grid').getGridParam('width'));
                        $(".ui-jqgrid-bdiv").css("width", $('#grid').getGridParam('width'));
                        $(".ui-jqgrid-hdiv").css("width", $('#grid').getGridParam('width'));
                        $(".ui-jqgrid-view").css("width", $('#grid').getGridParam('width'));
                        $("#pager").css("width", $('#grid').getGridParam('width'));
                        $(".ui-jqgrid-hbox").css("padding-right", "0px");
                    }
    }
    

提交回复
热议问题