1
我有多個按鈕在按鈕工具欄中加載我需要這些按鈕去不同的鏈接。但是,我一直無法弄清楚。以下是我試圖做的,但不起作用。如何鏈接Sencha觸摸工具欄中的按鈕?
//Below are three buttons that need to go to three different links
var buttonsGroup1 = new Ext.Button({
text: 'MESSAGES',
handler: tapHandler
});
var buttonsGroup2 = new Ext.Button({
text: 'HOLDS',
handler: tap2Handler
});
var buttonsGroup3 = new Ext.Button({
text: 'FINANCIALS',
handler: tapHandler
});
//Click on the button and it goes to these links
var tapHandler = function (btn, evt) {
window.location = 'index.html';
};
var tap2Handler = function (btn, evt) {
window.location = 'redirect.php';
};
//Combine all the variables above and some other stuff and then add it to docked items very object oriented =)
var dockedItems = [
{
xtype: 'toolbar',
title: 'Student Portal',
ui: 'light',
dock: 'top',
items: buttonsSpecTop,
defaults: { handler: tapHandler }
},
{
xtype: 'toolbar',
ui: 'dark',
items: [buttonsGroup1, buttonsGroup2, buttonsGroup3], //This is where I load up all the buttons
dock: 'bottom',
layout:{
pack: 'center'
},
defaults: [handler: tapHandler, handler: tap2Handler] //This is the handler for the links
}];
我將如何使用處理程序偵聽器來查看每個按鈕 – Alex
我可以看到,您已經將處理程序(tapHandler和tapHandler2)連接到每個單獨的按鈕。所以,只需刪除默認配置。它會工作。 – Swar