English 中文(简体)
ExtJS 4 cell “renderer” problem
原标题:ExtJS 4 cell "renderer" problem

在阅读

• 内部职能:

renderer: this.onRenderCell

这一职能也一样:

onRenderCell: function(value, metaData, record, rowIndex,
  colIndex, store, view) {
  metaData.css =  ini-cell-pas-traduit ;
  return  « +value+ » ;
}   

请仔细阅读<代码>和格式;laquo; + Value+ &raquo;,each 价值改为:>; 这证明,在每一条线上,它都是完美的。 那么,这应该针对这些 c。 但是,两条之分中,两条之分都用了。 这驱使我有营养。

这里,它所提供的东西(最新消息——第纳尔多,与最新的 Chrome一样):

“ExtJS

我应研究什么想法?

我的源代码大体样本:

Ext.define( Lang.grid.Panel , {
    extend:  Ext.grid.Panel ,
    alias:  widget.langgrid ,

    requires: [
         Ext.grid.plugin.CellEditing ,
         Ext.form.field.Text ,
         Ext.toolbar.TextItem 
    ],

    initComponent: function(){

        this.editing = Ext.create( Ext.grid.plugin.CellEditing );

        Ext.apply(this, {
            iconCls:  icon-grid ,
            plugins: [this.editing],
            dockedItems: [{
                xtype:  toolbar ,
                items: [{
                    iconCls:  icon-add ,
                    text:  Add ,
                    scope: this,
                    handler: this.onAddClick
                }, {
                    iconCls:  icon-delete ,
                    text:  Delete ,
                    disabled: true,
                    itemId:  delete ,
                    scope: this,
                    handler: this.onDeleteClick
                }]
            }],
            columns: [{
                text:  label ,
                flex:2,
                sortable: true,
                dataIndex:  label 
            },{
              header:  fr ,
              flex: 3,
              sortable: true,
              dataIndex:  fr ,
              renderer: this.onRenderCell,
              field: {
                type:  textfield 
              }
            },{
              header:  es ,
              flex: 3,
              sortable: true,
              dataIndex:  es ,
              renderer: this.onRenderCell,
              field: {
                type:  textfield 
              }
            },{
              header:  us ,
              flex: 3,
              sortable: true,
              dataIndex:  us ,
              renderer: this.onRenderCell,
              field: {
                type:  textfield 
              }
            }
            ]
        });
        this.callParent();
        this.getSelectionModel().on( selectionchange , this.onSelectChange, this);
    },

    (...)
    (snip useless code)
    (...)

    onRenderCell: function(value, metaData, record, rowIndex,
      colIndex, store, view) {
      metaData.css =  ini-cell-pas-traduit ;
      return  <span style="color:red; font-weight:bold;">&laquo; +
        value+ &raquo;</span> ;
    }
});
最佳回答

在元数据中(尼微-帕斯-特拉杜伊特)为<代码>后背-color。

background-color : red !important //or whichever color you ve specified.

EDIT : This is happening because the grid is configured with stripeRows : true. I dunno if this is done by default or you did it in the config but forgot to mention it here. When you use stripeRows it sets a background-color which can be overriden using the !important keyword.

问题回答

Varun Achar使用! 进口商是正确的,但由于你使用Ext JS 4,你也应当改变。

甲型六氯环己烷

纽约总部

metaData.tdCls = ini-cell-pas-traduit ;

甲型六氯环己烷和乙型六氯环己烷的 c子和tr子现已改为tdCls和tdAttr,如果你也安装了Ext 3容性层,则旧的 members子和 members子只能在Ext JS 4中工作。





相关问题
WPF: Adding Button Column to Datagrid

How can I add a Button column to a Datagrid programmatically? I want to do this through code in the code-behind file. Also i want to selectively enable or disable this button based on record (If ...

Silverlight Datagrid RowEditEnded

I have a SL DataGrid that has two columns. I need to be able to catch any change to the a row and save it into an undo stack. I setup the event RowEditEnded and tried to add to the undo stack there. ...

WPF Keep column sorting with Datagrid

I have several datagrid where I need to update the informations. Things is, since more than one person works on the system at the same time, the datagrid need to be refreshed on a regular basis. When ...

热门标签