lm121342074 2017-06-22 01:27 采纳率: 7.1%
浏览 1100
已采纳

extjs中的grid中的数据加载问题!

{
header : 'psnId',
hidden:true,
dataIndex : 'psnId'
},
{
header : '部门/单位',
width:120,
align: 'left',
sortable: true,
//dataIndex : 1=='DEP_001'?'psnDeptName':'psnOrgName'
}

基本代码如上,怎样才能在不同的情况下,一种情况显示部门名称,一种情况显示机构名称。求大神指点一下!!!
  • 写回答

1条回答 默认 最新

  • 斯洛文尼亚旅游 2017-06-22 01:32
    关注

    renderer根据当前行其他值返回对应的数据
    http://docs.sencha.com/extjs/4.1.3/#!/api/Ext.grid.column.Column-cfg-renderer

     renderer : Function/String
    A renderer is an 'interceptor' method which can be used to transform data (value, appearance, etc.) before it is rendered. Example:
    
    {
        renderer: function(value){
            if (value === 1) {
                return '1 person';
            }
            return value + ' people';
        }
    }
    Additionally a string naming an Ext.util.Format method can be passed:
    
    {
        renderer: 'uppercase'
    }
    Defaults to: false
    
    Available since: 3.4.0
    
    value : Object
    The data value for the current cell
    metaData : Object
    A collection of metadata about the current cell; can be used or modified by the renderer. Recognized properties are: tdCls, tdAttr, and style.
    record : Ext.data.Model
    The record for the current row
    rowIndex : Number
    The index of the current row
    colIndex : Number
    The index of the current column
    store : Ext.data.Store
    The data store
    view : Ext.view.View
    The current view
    return : String
    The HTML string to be rendered.
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据