1

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

J Bond
  • 33
  • 8

2 Answers2

1
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.

wombleton
  • 8,336
  • 1
  • 28
  • 30
1

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.

Community
  • 1
  • 1
Chau
  • 5,540
  • 9
  • 65
  • 95