Extjs 6 ItemSelector如何以编程方式绘制行

时间:2017-09-11 13:39:55

标签: javascript extjs extjs6 extjs6.2 itemselector

我使用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的后续处理中使用它:

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

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

1 个答案:

答案 0 :(得分:1)

问题是在呈现期间viewConfig已应用于视图。

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

相关问题