列的JqGrid工具提示 [英] JqGrid tooltip for a column

查看:219
本文介绍了列的JqGrid工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何在列级别添加工具提示.我所说的列级别是指所有行(属于同一列)应该具有相同的工具提示内容.

How can we add a tooltip on a column level. What I mean by column level is that all the rows( belonging to the same column) should have the same tooltip content.

例如,考虑一个名为"Manager Name"的列.该列的所有行应将工具提示显示为单击此处以查看经理的详细信息".

For eg, Consider a column called "Manager Name". All rows of that column should display tooltip as "Click here to see manager details".

这可以在colModel级别完成.我知道自定义格式器,可以在其中添加标题到"cellValue".但是我真的不是在寻找这个,因为我已经在使用复杂的自定义格式化程序.

Can this be done on colModel level. I am aware of custom formatters, where I can add title to "cellValue". But I am really not looking for this as I am already using a complicated custom formatter.

我希望有一个直接的方法来实现这一目标.

I hope there is a straight forward way to achieve this.

推荐答案

您可以使用

cellattr: function () { return ' title="the tooltip text"'; }

我在具有formatter: "checkbox"的每一列上亲自使用这种工具提示.如果人们有许多带有chechbox的列,并查看网格中间的某一行,这是非常实用的.在这种情况下,通常很难确定复选框在哪一列中.在这种情况下,上面的工具提示会很有帮助.

I use such kind of tooltips personally on every column having formatter: "checkbox". It is very practical if one have many columns with chechboxes and look at some row in the middle of the grid. In the case it's frequently difficult to determine in which column is the checkbox. In the case the above tooltips are very helpful.

就像您看到cellattr是一个函数一样,它具有一些可选参数:rowIdcellValuerawObject等(请参见

Like you see the cellattr is a function and which has some optional parameters: rowId, cellValue, rawObject etc (see the documentation). It allows you to create really flexible tooltip texts.

再说一遍.与自定义格式化程序相比,cellattr的优势在于您可以继续使用预定义格式程序,并仅设置自定义属性,例如titleclass等.因此,您可以在具有selectdateintegercheckbox等格式化程序的列上设置自定义属性.

One more remark. The advantage of cellattr compared to the custom formatters is that you can continue to use predefined formatters and set only custom attributes like title, class and so on. So you can set custom attribute on the columns having select, date, integer, checkbox and so on formatter.

这篇关于列的JqGrid工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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