jquery - jqgrid v4.4.5 rtl水平

标签 jquery asp.net jquery-ui jqgrid

enter image description here我使用jqgrid v4.4.5和jquery v1.9.1。 当我调整 jqgrid 的大小并且出现水平滚动条时,它可以在 IE 和 Firefox 上运行。但在 Chrome 中不起作用,列被截断并且宽度计算错误。

我该如何解决这个问题?

<script>

    $(function () {
        $("#UsersGrid").jqGrid({
            direction:"rtl",
            url: 'jqGridHandler.ashx',
            datatype: 'json',
            height: 250,
            colNames: ['UserID', 'UserName', 'FirstName', 'MiddleName', 'LastName', 'EmailID'],
            colModel: [
                    { name: 'UserID', index: 'UserID', width: 100, sortable: true },
                    { name: 'UserName', width: 100, sortable: true },
                    { name: 'FirstName', width: 100, sortable: true },
                    { name: 'MiddleName', width: 100, sortable: true },
                    { name: 'LastName', width: 100, sortable: true },
                    { name: 'EmailID', width: 150, sortable: true }
            ],
            rowNum: 10,
            rowList: [10, 20, 30],
            pager: '#UsersGridPager',
            sortname: 'UserID',
            viewrecords: true,
            sortorder: 'asc',
            caption: 'JSON Example'
        });

        $("#UsersGrid").jqGrid('navGrid', '#UsersGridPager', { edit: false, add: false, del: false });
    });
</script>

enter image description here

最佳答案

documentation 中所示shr​​inkToFit 属性如果设置,则定义如何重新计算网格列的宽度,同时考虑网格的宽度。如果该值为 true,并且还设置了列的宽度,则每列将按其宽度的比例缩放。

When set to true, the grid width is recalculated automatically to the width of the parent element. This is done only initially when the grid is created. In order to resize the grid when the parent element changes width you should apply custom code and use a setGridWidth method for this purpose.

因此,您只需将属性添加到 jqGrid 即可:

shrinkToFit:true,

关于jquery - jqgrid v4.4.5 rtl水平,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16034005/

相关文章:

javascript - onclick时确认消息

javascript - 当我运行 jQuery 命令时,该元素不存在

javascript - jQuery - 获取 IE9 中附加内容的 HTML(没有选择包装器的选项)

asp.net - 如何使用asp.net webapi获取Json Post值

jquery - 在 Internet Explorer 中自动调整 jQuery UI 对话框的大小

javascript - Jquery切换具有相同ID的图像

javascript - 将我的 Javascript 对象转换为参数字符串时遇到问题

asp.net - Request.Form "Collection is only readonly"尝试设置文本框内容时

c# - html.textboxfor() 应该正好是 7 个字符

javascript - jQuery UI 奇怪的按钮问题