jqGrid cellattr标题将忽略空格后的文本 [英] jqGrid cellattr title ignores text after white spaces
问题描述
我在jqgrid中有colmodel,其中具有名称"和描述"列,并且我需要将描述显示为工具提示,同时将鼠标悬停在名称"列上.
I have colmodel in jqgrid which has 'name' and 'description' columns and i need to show the description as tooltip while hovering over the 'name' column.
说我有这样的模型,例如:
Say i have this model for eg :
colModel: [
{
name: "name",..
cellattr: function (rowId, val, rawObject, cm, rdata) {
return 'title=' + rawObject[1];
}
},
{name : "description",..},
],
数据呈现为工具提示,但是如果我的描述为低级别标准",则工具提示为低".
the data is rendered as tooltip but if i have description as "Low Level Standard" , the tooltip is "Low".
理想情况下,它会忽略空格后的所有文本.
Ideally it ignores all text after white space.
我该如何解决? 我是jqGrid的新手. 请尽可能详细地解释 谢谢
How do i fix this? I am new to jqGrid. Pls explain in detail if possible Thanks
推荐答案
您应该以空格开始返回值. rawObject
的确切格式可能取决于许多因素:以哪种格式填充网格数据.因此,您应该验证是否应该使用像rawObject[1]
这样的索引还是应该使用像rawObject.description
这样的名称.因此解决方案可能类似于
You should start returned value with space. The exact format of rawObject
can depend on many things: in which format you fill the grid data. So you should verify whether you should use index like rawObject[1]
or the name like rawObject.description
. So the solution could be like
cellattr: function (rowId, val, rawObject) {
return ' title="' + rawObject[1] + '"';
}
或喜欢
cellattr: function (rowId, val, rawObject) {
return ' title="' + rawObject.description '"';
}
取决于您使用的数据格式(以及rawObject
的格式).我在标题中添加了"
.
depend on the format of the data which you use (and so from the frormat of rawObject
). I added "
to the title.
通过这种方式,您可以看到我从回调中删除了cm, rdata
,因为我们没有在其中使用它.
By the way like you could see I removed cm, rdata
from the callback because we don't use there.
这篇关于jqGrid cellattr标题将忽略空格后的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!