0

私は6つのコンテナを持っていcls: tipoDocumento contratoます:

            {
                xtype: 'container',
                layout: 'vbox',
                align: 'center',
                hidden: true,
                cls: 'tipoDocumento contrato',
                listeners: {
                    click: {
                        element: 'el',
                        fn: function (e, t) {
                            alert("FIRMAR")
                        }
                    },
                    mouseover: {
                        element: 'el',
                        fn: function (e, t) {
                            this.addCls('rowGridAzul')
                        }
                    },
                    mouseout: {
                        element: 'el', //bind to the underlying el property on the panel
                        fn: function (e, t) {
                            this.removeCls('rowGridAzul')
                        }
                    }
                },
                items: [
                    {
                        xtype: 'image',
                        src: 'img/custom/XL_firmar.png',
                        width: 66,
                        height: 66,
                        cls: 'imagen_elegir_tipo_documento'
                    },
                    {
                        xtype: 'label',
                        layout: 'fit',
                        text: lang.getString('FIRMAR'),
                        width: 66,
                        cls: 'textoElegirTipoDocumento'
                    }
                ]
            },

と 5 のみcls: tipoDocumento

最初の componentQuery を使用すると、クラスに「contrato」を含む 6 つの要素が返されます。しかし、2 番目の componentQuery を使用すると、'cls: tipoDocumento' のみを持つ 5 つの要素ではなく、0 項目が返されます。

Ext.ComponentQuery.query('#listadoTiposDeDocumento')[0].query("container[cls~=contrato]");

Ext.ComponentQuery.query('#listadoTiposDeDocumento')[0].query("container:not[cls~=contrato]");

このアイテムの cls は動的であるため、これが唯一の方法ですが、私は何か間違ったことをしていて、それを見ることができません。

4

1 に答える 1

0

括弧が足りないと思います。そのはず

Ext.ComponentQuery.query('#listadoTiposDeDocumento')[0].query("container:not([cls~=contrato])");

ドキュメントを見る

于 2021-02-25T17:48:06.513 に答える