开发者

ExtJS buttons won't accept "id" config parameter?

开发者 https://www.devze.com 2023-02-22 14:56 出处:网络
I need specific IDs on ExtJS generated window buttons, but I\'m having trouble specifying the ID. The documentation claims that this should be possible, but I still get an autogenerated id when I spec

I need specific IDs on ExtJS generated window buttons, but I'm having trouble specifying the ID. The documentation claims that this should be possible, but I still get an autogenerated id when I specify my own.

What gives?

dialog = new Ext.Window({
            closeAction:'hide',
            plain: true,
            buttons: [
                {
                    id: 'my-dialog',
                    text: 'Done',
                    开发者_Python百科handler: function() {
                        dialog.hide();
                    }
                }
            ],
            items:new Ext.Panel({
                applyTo:'add-document-popup-panel'
            }),
            title: 'Add Documents',
            layout: 'fit',
            resizable: false,
            draggable: false,
            width: 300,
            height: 300,
            modal: true
        });
    }
    dialog.show(this);


Check this topic: http://www.sencha.com/forum/showthread.php?24433-CLOSED-Cannot-assign-id-to-button-extjs-bug

The id of the container of the button is set, not the HTML button itself.


The id you specify is assigned to the button component (specific to extjs) and not necessarily to the underlying html button.

Does Ext.getCmp('my-dialog') successfully return the extjs button component?


The ID is set, but not on the actual button element. One of the containers is set with the correct id, and you can probably key off of this to get at whatever you need.


I had the same problem and I confirm:

  • The ID is set in the button's TABLE container.

  • Ext.getCmp('my-button') returns the extjs button component (object with xtype="button" and id="my-button").

0

精彩评论

暂无评论...
验证码 换一张
取 消