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

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

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

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

1条回答 默认 最新

  • showbo
    已采纳

    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.
    
    点赞 评论

相关推荐