-
22 Nov 2011 7:28 AM #1
How to get the click or tap event working on a Ext.Panel ?
How to get the click or tap event working on a Ext.Panel ?
Hello, I tried this and other solutions, but I don't see the alert box showing up.
Am I doing it wrong? I used the sencha-touch-all.js
Regards, Chris.
Ext.application({
name: 'Sencha',
launch: function() {
//this is the Panel we'll be adding below
var aboutPanel = Ext.create('Ext.Panel', {
html: 'About this app'
});
var otherPanel = Ext.create('Ext.Panel', {
html: 'Another Panel'
});
//this is the Panel we'll be adding to
var mainPanel = Ext.create('Ext.Panel', {
fullscreen: true,
layout: 'hbox',
defaults: {
flex: 1
},
items: {
html: 'First Panel',
style: 'background-color: #5E99CC;'
}
});
Ext.Viewport.add(mainPanel);
mainPanel.add(aboutPanel);
mainPanel.add(otherPanel);
aboutPanel.addListener('click', function(){alert('click'), this });
}
});
-
22 Nov 2011 7:56 AM #2
welcome to the community chrismobile.
first, please choose one of the correct forums to write questions to.
i can assume that you are using Sencha Touch 1 or 2, but this already makes a big difference. If you are using the 1 / 2 Q&A forums, you will get more views and probably faster and better help.
to your problem: you can only listen to the events of any ext component / container, that are specified in the API docs. "click" is an event for a dom node, that can not be directly put on a JS construct.
should already help. and please use code tags, since they preserve the formatting of code.Code:aboutPanel.getEl().addListener('click',...
-
24 Nov 2011 5:09 AM #3
thanks!
thanks!
Thank you for your time and reply, This was my first post as I am complete new to the sencha framework. It's a really great framework!
I will post my questions from now on in the right forum topic!
Regards,
Chris.


Reply With Quote