如何使 Jqgrid 冻结列自动换行 [英] How to make Jqgrid frozen column word-wrap

查看:13
本文介绍了如何使 Jqgrid 冻结列自动换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用最新的 jqgrid 捆绑包 4.4.5.我想使标题列自动换行.我读了奥列格 回答,但似乎它不适用于最新的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 is undefined".

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".

有没有办法让它工作?

编辑:在我改变 $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;

这是图片链接.

推荐答案

jqGrid从4.3.2版本开始支持Events 允许注册多个回调(事件处理程序)._complete 等旧的内部回调已被移除.

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

更新:当前版本的 jqGrid 在 .它将使用 this 而不是 ts:

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屋!

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