ExtJS Grid的两个格式处理方法

1. 使Grid内容可复制

  • 加入CSS

<style type="text/css">
.x-selectable, .x-selectable * {                
 -moz-user-select: text !important;                 
-khtml-user-select: text !important;     
-webkit-user-select: text !important; }  
.x-grid-row td, 
.x-grid-summary-row td, 
.x-grid-cell-text, 
.x-grid-hd-text, 
.x-grid-hd, 
.x-grid-row,  
.x-grid-row, 
.x-grid-cell, 
.x-unselectable {     
-moz-user-select: text !important;     
-khtml-user-select: text !important;     
-webkit-user-select: text !important; }

  • 修改javascript,在gridpanel里添加属性

viewConfig: {     
    disableSelection: true,     
    stripeRows: false,     
    getRowClass: function(record, rowIndex, rowParams, store){         
        return "x-selectable";     
    } 
}, 

2. 使Grid内单元格内容自动换行

方法一:为单元格加入renderer方法

function textRenderer(value, metadata, record) {
		metadata.attr = 'style="white-space:normal;"';
		return value;
	}

如果有必要,把grid的forcefit设为false。


方法二:加入css

.x-grid3-cell-inner, .x-grid3-hd-inner{  
     overflow:hidden;  
     -o-text-overflow: ellipsis;  
     text-overflow: ellipsis;  
     padding:3px 3px 3px 5px;  
     /*white-space: nowrap;*/  
     white-space:normal !important;   
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值