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.
How do i fix this? I am new to jqGrid. Pls explain in detail if possible Thanks
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] + '"';
}
or like
cellattr: function (rowId, val, rawObject) {
return ' title="' + rawObject.description '"';
}
depend on the format of the data which you use (and so from the frormat of rawObject
). I added "
to the title.
By the way like you could see I removed cm, rdata
from the callback because we don't use there.