0

我正在使用 ExtJS 6.0.2,我有一个包含以下信息的itemselector :

                               {
                                        xtype: 'itemselector',
                                        name: 'itemselector',
                                        id:'issuerSelector',
                                        buttons: ['add', 'remove', 'allleft','allright'],
                                        height: 300,
                                        width: '30%',
                                        store: 'ItemsStore',
                                        displayField: 'code_isin',
                                        valueField: 'id_valeur',
                                        fromTitle: "fromList",
                                        toTitle: 'toList',
                                        listeners: {
                                          afterrender: function (selector) {
                                              selector.onDisable();
                                          },
                                          change: 'someFuncHere'
                                        },
                                }

我想要的是,在加载 itemselector 数据后,列表“fromField”上的任何数据:

flag : 1

...应该以不同的方式绘制。(注意:我不想为此做一个“onChange”事件,因为我希望它在加载时而不是在更改后识别)。

我尝试在 ItemSelector 的 afterrender 上使用它:

Ext.getCmp('issuerSelector').viewConfig = { 
                    getRowClass    : function( record ) { 
                        if ( record.data.flag == 1 ) {
                            return 'newCss';
                        }
                    }
                }

...但是由于某种原因,css 不会显示,即使删除了 if,新的 css 也永远不会应用于 itemSelector(这通常适用于网格)。所以我在这里问是否有人可以帮助我找到解决这个问题的方法。

4

1 回答 1

1

问题是viewConfig在渲染期间已经应用于视图。

您可能要检查的是是否grid.getView().getRowClass = function() ...有效。

于 2017-09-11T14:13:30.390 回答