PDA

View Full Version : Open new page on Button Click



ssk_hari
17 Mar 2011, 11:43 PM
Hi, Am new to Sencha .... I require to open a new page on button click. How can I do it ?

danguba
18 Mar 2011, 12:52 AM
Put window.open(url) in button handler?

ssk_hari
18 Mar 2011, 1:19 AM
But, it opens up a new window. I would like it to work like a link (ahref) where it opens in the same window ..

Thanks,
Hari.

danguba
18 Mar 2011, 1:26 AM
window.open(url, "_self")

http://www.w3schools.com/jsref/met_win_open.asp

steffenk
18 Mar 2011, 1:32 AM
better:
document.location.href = url;

ssk_hari
18 Mar 2011, 1:35 AM
Does, ahref work om sencha ..

Will my below code snippet work ?

new Ext.Panel({
layout: {
type: 'vbox',
align: 'stretch'
},
fullscreen:true,
items: [{
xtype:'button',
html: '<a href="details.html"> Delta </a>',

}]
});

danguba
18 Mar 2011, 1:40 AM
better:
document.location.href = url;

Indeed

danguba
18 Mar 2011, 1:44 AM
Use


new Ext.Panel({
layout: {
type: 'vbox',
align: 'stretch'
},
fullscreen:true,
items: [{
xtype:'button',
text: "Details",
handler: function(){
document.location.href = "details.html";
}
});

ssk_hari
18 Mar 2011, 1:44 AM
That's coool ... It worked.

Both, window.open(url, "_self") and document.location.href = url; works !!!

Thanks danguba, steffenk ..

One clarification : Does usage of html tags inside the 'html:' identifier work realtime ??

Ex : html: '<div class="status_star"><a href="#" class="follow favorite">Fav</a></div>'

danguba
18 Mar 2011, 1:46 AM
I think that button swallows click event

ajainvivek
27 Oct 2011, 1:34 AM
This the controller function

Ext.regController('Home', {....
list: function()
{....

I need to traverse to this controller function when i submit the button

handler: function() {
// TO DO
}