5.Ext JS actioncolumn动态加载图标/提示

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/inforstack/article/details/54237726

官网介绍

图标加载

getClass : Function  

    A function which returns the CSS class to apply to the icon image.  

    Parameters  
        v : Object  
        The value of the column's configured field (if any).  

        metadata : Object  
        An object in which you may set the following attributes:  

            css : String  
            A CSS class name to add to the cell's TD element.  

            attr : String  
            An HTML attribute definition string to apply to the data container element within the table cell (e.g. 'style="color:red;"').  

        r : Ext.data.Model  
        The Record providing the data.  

        rowIndex : Number  
        The row index.  

        colIndex : Number  
        The column index.  

        store : Ext.data.Store  
        The Store which is providing the data Model.  

提示加载

getTip : Function

A function which returns the tooltip string for any row.
Parameters

    v : Object
    The value of the column's configured field (if any).

    metadata : Object
    An object in which you may set the following attributes:

        css : String
        A CSS class name to add to the cell's TD element.

        attr : String
        An HTML attribute definition string to apply to the data container element within the table cell (e.g. 'style="color:red;"').

    r : Ext.data.Model
    The Record providing the data.

    rowIndex : Number
    The row index.

    colIndex : Number
    The column index.

    store : Ext.data.Store
    The Store which is providing the data Model.


项目实战

text : "操作",
xtype:'actioncolumn',
sortable : false,
width : 190,
items : [{
	handler : "projectFavorite",
	name : 'projectFavorite',
	getClass : function (v, metadata, r, rowIndex, colIndex, store) {
		if (me.userType == '20') {
			if (r.data.partaked){ 
				return "x-item-disabled x-fa fa-heart";
			} else {
				return r.data.favorite == true ? "x-fa fa-heart" : "x-fa fa-heart-o";
			}
		}
	},
	getTip : function (v, metadata, r, rowIndex, colIndex, store) {
		if (me.userType == '20') {
			return r.data.favorite == true ? "取消关注" : "关注";
		}
	}
}]


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值