PDA

View Full Version : hyperlink gridhead button



robin30
4 Oct 2007, 12:17 PM
small question, if you don't mind.

i do have a grid.
and in that grid i have a button.


var tb = new Ext.Toolbar(gridHead, [{
text: 'View Details Statement',
cls: 'x-btn-text-icon',
icon: 'images/icons/page.png',
}]);


now my question is how can i put a hyperlink in that button. so when i press that button a new webpage will show up.
I tried it with url:'blablabla.html' but that doesn't work with me.

regards
Robin

ferr
4 Oct 2007, 12:20 PM
try this:
text: "<a href='your page'>View Details Statement</a>",

be sure to use double quotes as I'm pretty sure you'd run into a scope conflict within the html tag for the url.

robin30
4 Oct 2007, 2:45 PM
thanks for your reply,appreciate it.

your suggestion didn't work.

at least now for me, the button became a hyperlink but when i press the button, nothing happened.

but then i start to think again. it's all javascript (modern day) so i tried


window.location = "http://www.google.com/"

and it works when i press the button, it will go to google.

so this is my now.
i know it's to much code or code that doesn't do a thing rightnow, but i have to figure out what i can remove so that it still will work.


text: "View Details Statement",
cls: 'x-btn-text-icon',
icon: 'images/icons/page.png',
handler: function() {
selectedRow = grid.getSelectionModel().getSelected();
if(selectedRow) {
var conn = new Ext.data.Connection;
conn.request({
url:'bankdetails.html?id='+selectedRow.data.id,
params:{rowid:selectedRow.data.id},
callback: function(options, success, response){
if (success){
window.location = "bank.html?id="+selectedRow.data.id

}
}