Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.8k views
in Technique[技术] by (71.8m points)

jquery - How to make Jqgrid frozen column word-wrap

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...