PDA

View Full Version : link in toolbar



darkbob
1 Feb 2008, 8:39 PM
Hi,
I need to implement a "export to excel". I can make it work with a handler (event). Unfortunatly, doing so, popups a security message in IE.

Do deal with this, I'm trying to add a link instead of a button in my toolbar.
I believed this would have been really simple but it simple does not work ...


is there a way to do something like this

tbar:{
text:'export',
href:'generateExcel.php' <-----
}


thx!

ckr
1 Feb 2008, 9:44 PM
http://extjs.com/forum/showthread.php?p=87536#post87536

evant
1 Feb 2008, 9:57 PM
Yeah, you'll need to use a handler:



{
text: 'Export',
handler: function() { document.location.href = 'myUrl'; }
}

darkbob
2 Feb 2008, 6:30 AM
Yes, I did use a handler and it worked. But in IE, this cause a security mesage that you need to accept since the download was triggered by javascript.

What I need is a simple <a href="dsds">Export</a> in the toolbar instead of a regular button.

darkbob
2 Feb 2008, 6:34 AM
k I just saw the ButtonLink.

I have a problem when adding things to the toolbar ( I usually do it directly tbar:{etc.}
)

the problem is --->this.tr has no properties :-?
Is it because of rendering or something? I thought it would do the rendering alone when you add the toolbar to tbar: (in a grid panel)

mike1993
2 Feb 2008, 8:47 PM
IE security popup? Strange.. I use handler, too.


function flatFileHandler() {
location.href = baseParamsConfig.flat_file;
}


Are you sure the server supplies proper header w/ content/type for the Excel file?

darkbob
3 Feb 2008, 8:44 AM
Yes, it doesn't happen in firefox only IE (IE6 needs sp2 for it to show up)since the handler itself is an event and it could be launch without the user wanting to download the file.

Anyway, the linkbutton class worked and it doesn't popup the security message with it since it's the user who clicks on it directly and not javascript.