Ext JS – Putting a link in a FormPanel

I wanted to put a link in a FormPanel. I found some helpful posts in the forum and here it is in a nutshell (thanks to Condor’s postings). The idea is creating a BoxComponent with an href element. During render, attach a listener to the href for the click event. Watch out for scope!

{
    itemId: 'resestLink',
    xtype: 'box',
    autoEl: {
        tag: 'a',
        href: '#',
        html: 'Reset Criteria'
    },
    listeners: {
        scope: this,
        render: function(c){
            c.getEl().on('click', this.onResetClick, this, {stopEvent: true});
        }
    }
}

Link to related posting on Ext JS forums:
Add hyperlink in FormPanel

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s