Extjs 6 ItemSelector how to programmatically paint rows

212 Views Asked by At

I'm using ExtJS 6.0.2, i have an itemselector with the following information:

                               {
                                        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'
                                        },
                                }

What i want is, after loading the itemselector data, any data on the list "fromField" with:

flag : 1

...should be painted differently. (Note: I don't want to do an "onChange" event for this, since i want this to recognize on the load and not after a change).

I've tried to use this on the afterrender of the ItemSelector:

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

...But for some reason the css won't display, even if a remove the if, the new css is never applied to the itemSelector (this normaly works on grids). So I'm here to ask if anybody can help me find a solution to this problem.

1

There are 1 best solutions below

2
On BEST ANSWER

The issue is that viewConfig is already applied to the view during rendering.

What you may want to check is whether grid.getView().getRowClass = function() ... works.