How to make Jqgrid frozen column word-wrap

自古美人都是妖i 提交于 2019-11-26 10:00:41

问题


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.

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?

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.

Note: I change \"this.grid\" using local variabel. var grid = this.grid || this;

Here is the image link.


回答1:


Starting with version 4.3.2 jqGrid supports Events which allows to register multiple callbacks (event handler). Old internal callbacks like _complete were removed.

Instead of the line in the demo

$grid[0].p._complete.call($grid[0]);

you can use now

$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); }

instead of

if($.isFunction(p.resizeStop)) { p.resizeStop.call(ts,nw,idx); }

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);
});

See the modified demo.

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.

Just published version 4.5.0 includes the fix.



来源:https://stackoverflow.com/questions/16516356/how-to-make-jqgrid-frozen-column-word-wrap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!