How to create hyper link in ExtJS 4?

风格不统一 提交于 2019-12-23 07:25:24

问题


I am working in ExtJS 4.I have been getting stuck at a point where I have to create a hyperlink in ExtJS 4.I have been searching a lot for creating hyperlink in ExtJS 4 but I did not get any solution for it.Actually I have to create a hyperlink and after clicking on that link I am going to display another page in ExtJS 4. Actually also i did not get the event in ExtJS 4. How can I use hyperlink in ExtJS 4. I am using this way...

{
      xtype: 'panel',
      html:'<a href="second.js">Second page</a>',
}  

Please give me some suggestions.....


回答1:


I'd use an autoEl for this.

{
    xtype: 'component',
    autoEl: {
        tag: 'a',
        href: 'http://www.example.com/',
        html: 'Example.com'
    }
}

Here's a Fiddle




回答2:


You can also use the html property of a label component and call a controller function from there. Example:

{xtype: 'label',
html: 'bla bla? <a href="#" onClick="javascript:appName.app.getController(\'myController\').showRegistration();">Register</a>'
}


来源:https://stackoverflow.com/questions/15477861/how-to-create-hyper-link-in-extjs-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!