如何使Jqgrid冻结列自动换行 [英] How to make Jqgrid frozen column word-wrap
问题描述
我正在使用最新的jqgrid软件包4.4.5. 我想使标题列自动换行. 我阅读了Oleg 答案,但似乎不适用于最新的jqgrid.
I am using the latest jqgrid bundle 4.4.5. I want to make header column word-wrap. I read the Oleg answer but seem it's not working with the latest jqgrid.
firebug中出现的错误消息是"$ grid [0] ._ complete"是未定义的,并且在调整列的大小时,错误是"this.grid是未定义的".
The error messages that appear in firebug is "$grid[0]._complete" is undefined and when is resize the column the error is "this.grid is undefined".
有什么解决方案可以使它正常工作吗?
Is there any solution to make it work?
编辑:在我更改$ grid.jqGrid('setFrozenColumns');之后,到$ grid.triggerHandler("jqGridAfterGridComplete"); 现在,当我调整列的大小时,冻结的div列也不会重新调整大小.
Edit : after I change $grid.jqGrid('setFrozenColumns'); to $grid.triggerHandler("jqGridAfterGridComplete"); Now when I resize the column, the frozen div column isn't resize too.
注意:我使用本地变量来更改"this.grid". var grid = this.grid ||这个;
Note: I change "this.grid" using local variabel. var grid = this.grid || this;
这是图像链接.
推荐答案
Starting with version 4.3.2 jqGrid supports Events which allows to register multiple callbacks (event handler). Old internal callbacks like _complete
were removed.
代替
$grid[0].p._complete.call($grid[0]);
您现在可以使用
$grid.triggerHandler("jqGridAfterGridComplete");
UPDATED: The current version of jqGrid have a bug in the line. It will be used this
instead of ts
:
if($.isFunction(p.resizeStop)) { p.resizeStop.call(this,nw,idx); }
代替
if($.isFunction(p.resizeStop)) { p.resizeStop.call(ts,nw,idx); }
事件jqGridResizeStop
没有问题.所以我建议改用它:
The event jqGridResizeStop
don't have the problem. So I suggest to use it instead:
$grid.bind("jqGridResizeStop", function () {
resizeColumnHeader.call(this);
fixPositionsOfFrozenDivs.call(this);
fixGboxHeight.call(this);
});
请参见修改后的演示.
更新2 :我发布了修复已在github上jqGrid的主要代码中应用.
UPDATED 2: I posted the bug report. I can inform you that the fix is already applied in the main code of jqGrid on the github.
刚刚发布的版本4.5.0包含此修复程序.
Just published version 4.5.0 includes the fix.
这篇关于如何使Jqgrid冻结列自动换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!