就比如说 table 中 当鼠标滑过每一行 都有提示信息
在 html 中 好实现 在 ext grid 里 怎么弄啊?
在列映射的时候就要设定渲染方式
[code="js"]
var colModel = new Ext.grid.ColumnModel([
{ header: "$ Sales", width: 100, sortable: true, renderer: heihei}
]);[/code]
渲染的函数写成如下:
[code="js"]function heihei(value, meta, rec, rowIdx, colIdx, ds){
return '
顶部需要加入[code="js"]Ext.QuickTips.init();[/code]
qtitle代表tip的标题, qtip代表内容。这时鼠标划过就会出现提示!
Ext.grid.ColumnModel
[code="javascript"]
/**
* Returns the tooltip for the specified column.
* @param {Number} col The column index
* @return {String}
/
getColumnTooltip : function(col){
return this.config[col].tooltip;
},
/*
* Sets the tooltip for a column.
* @param {Number} col The column index
* @param {String} tooltip The new tooltip
*/
setColumnTooltip : function(col, tooltip){
this.config[col].tooltip = tooltip;
},
[/code]
官方FAQ里面已经有详细的几种做法说明:
[url]http://extjs.com/learn/Ext_FAQ_Grid#Add_ToolTip_or_Qtip[/url]
不过都是celltip,而不是rowtip
另外,3.0对column的doc里面有描述了一个tooltip,是对某一列批量设置的,不能改变:
Class Ext.grid.Column
tooltip : String
A text string to use as the column header's tooltip. If Quicktips are enabled, this value will be used as the text of the quick tip, otherwise it will be set as the header's HTML title attribute. Defaults to ''.
关于行提示的,
如果在2.2需要重写一些方法,如果是3.0就简单多了.
详见:[url]http://atian25.iteye.com/admin/blogs/417361[/url]
似乎发错了,
是 [url]http://atian25.iteye.com/blog/417361[/url]