我可以在jqgrid的cellattr中更改列宽吗? [英] Can I change column width in cellattr in jqgrid?

查看:287
本文介绍了我可以在jqgrid的cellattr中更改列宽吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在cellattr中更改列宽吗?我尝试过:

Can I change column width in cellattr? I tried this:

cellattr: function(rowId, value, rowObject, colModel, arrData) {
        return ' style= width: 100% !important; ';
    }

但是没有变化.我没有在colModel中放置宽度,而在cellattr中放置了宽度,似乎网格默认具有最大宽度,因此列内的文本被剪切掉了.

But there were no change. I didn't put width in colModel and put width in cellattr, it seems that the grid has max width for default so the texts inside the column is cutted.

推荐答案

cellattr可用于指定列的单个单元格(<td>元素)的属性. 列宽是所有单元格的通用宽度.不过,如果您需要为列的所有单元格分配样式属性,则应在代码中使用引号:

cellattr can be used to specify attributes of individual cells (<td> elements) of the column. The width of the column is the common width of all cells. Nevertheless if you need to assign style attribute to all cells of the column you should use quotes in your code:

cellattr: function () {
    return ' style="width: 100% !important;"';
}

如果执行此操作,将会看到style="width: 100% !important;"属性将分配给该列的所有<td>元素.我仍然不确定是否会遵循您期望的结果.

If you would do this you will see that the style="width: 100% !important;" attribute will be assigned to all <td> elements of the column. I still not sure that it will follows to results which you expect.

这篇关于我可以在jqgrid的cellattr中更改列宽吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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