jqGrid 4.8.0-使用新的宽度大小 [英] jqGrid 4.8.0 - Use of the new width size

查看:176
本文介绍了jqGrid 4.8.0-使用新的宽度大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网格,并且我还在每列上应用了(autoResizable: true).现在,我不希望每当我双击以调整列大小时,网格本身就会缩小/加宽.我希望网格本身保持原样.

I'm having a grid, and I also applied the (autoResizable: true) on each column. Now I don't want the grid itself to shrink/widen whenever I double click to resize the column. I want the grid itself to stay as is.

我阅读了有关setColWidth新功能的信息,但未能使用它.

I read about setColWidth new function, but failed to use it.

一个很好的例子.

setGridWidth实现是否有任何更改?我有两个网格,一个在另一个网格下面,看来在打电话后有一些网格宽度的计算:

Is there any changes to the setGridWidth implementation? I have two grids one below the other, and it appears that there is some calculation of the grid width AFTER my call is being made:

例如,每次执行以下命令时:

For example, each time I execute the following:

$(nameOfGrid).jqGrid('setGridWidth', $('.ui-layout-center').width() - 10, true);

在上述调用之后,两个网格都生效了,但是上网格比下网格短了一点(反之亦然),所以我想知道setGridWidth内是否有一些计算会影响整体体验

After the above call, both of the grid are effected, but the upper grid is shorter a bit from the lower (or vise versa), so I wonder if there is some calculation INSIDE the setGridWidth that effect the overall experience.

推荐答案

您写道:我不希望每当我双击以调整列大小时,网格本身就会收缩/加宽".另一方面,您写道:我还在每列上都应用了(autoResizable:true)".列中的属性autoResizable: true意味着您不希望列自动调整大小,双击列的大小将列宽更改为最佳值.因此,如果您不希望某些列自动升高,则应删除autoResizable: true属性.

You wrote "I don't want the grid itself to shrink/widen whenever I double click to resize the column". On the other side you wrote: "I also applied the (autoResizable: true) on each column". The property autoResizable: true in the column means nothing more that you want that the column will be auto-resizable and the double click on the resize of the column will change the column width to the optimal value. So if you don't want that some column will be auto-risizable you should remove autoResizable: true property.

免费jqGrid 4.8中的另一个选项是自述文件此处.您可以使用resizeDblClick回调作为示例,该回调返回false.这将防止在双击列大小调整器时调整列大小.回调的选项是iColIndexcm,它们可以使返回值取决于列.

One more option which one have in free jqGrid 4.8 is the usage of resizeDblClick callback or event jqGridResizeDblClick described in the readme here. You can use resizeDblClick callback for example which return false. It will prevent resizing of column on double-click on the column resizer. The options of the callback are iColIndex and cm which allows to make return value depend on the columns.

setColWidth方法最初是在答案中引入的.它包含该演示. 另一个演示将该方法用作

The method setColWidth was originally introduced in the answer. It contains the demo. One more demo use the method as plugin published on github. The same options have setColWidth of free jqGrid 4.8, but the implementation is a little other.

setGridWidth的最后一个问题对我来说还不是很清楚.我建议您始终创建简短的演示来重现该问题.在这种情况下,我可以很快找到问题的原因,并且可以建议您更改代码,也可以修复免费jqGrid中的错误.如果您只是描述自己有一个演示无法正常工作,请帮帮我.无论如何,我建议您将$('.ui-layout-center').width()值保存在变量中,并为使用的两个网格使用相同值调用setGridWidth.

The last problems with setGridWidth are not full clear for me. I recommend you always to create short demo which reproduce the problem. In the case I could find the reason of the problem very quickly and I could suggest either the changes of your code or I could fix the bug in free jqGrid. If you just describe that you have a demo which works incorrectly help me not. In any way I would suggest you to save $('.ui-layout-center').width() value in a variable and to call setGridWidth with the same value for two grids which you use.

这篇关于jqGrid 4.8.0-使用新的宽度大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆