开发者

how to create a button that links to textfile/excel sheet/url (EXTJS)?

开发者 https://www.devze.com 2023-02-25 12:28 出处:网络
I need to create a button that links to textfile/excel sheet/url.How to do the same in EXTJS ? Can any开发者_StackOverflowone help me with the code ?new Ext.Button({

I need to create a button that links to textfile/excel sheet/url.How to do the same in EXTJS ? Can any开发者_StackOverflowone help me with the code ?


new Ext.Button({
  text: 'PRESS ME',
  handler: function() {
    window.open('http://textfiles.com/or/spreadsheet.xls', '_blank');
  }
});

Or possibly window.location = http://somewhereelse.com/anotherfile.txt' in the handler if you don't want to open a new window.


I use the Ext.LinkButton (an extension you have to add your self) made by Animal and it works very well.

It uses an HTML <a href...> element so it acts as a normal link. I have had some troubles with wombleton's solution, because the browser might ask the user if it is okay to open this popup - due to the use of JavaScript methods.

You can also see the reference from a previous question here on stackoverflow.

0

精彩评论

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