PDA

View Full Version : Click/swap handler for a panel



kristalaz
19 Feb 2011, 8:58 AM
[some problems are SOLVED, like having different handlers]:

Hello,

i have following question:

I have a panel, inside of it an element that has one div with img and section inside.
If the image is clicked, the image should be fliped ( using flip) and new text in paragraph should be displayed ( using jquery for simplicity :)
If the image is swiped, another panel should be shown.

How i can use two different handlers, for an item, that is not a button? Im sorry, but i try to figure out how it works sencha.

Can anyone help me? Thnx

I have a folowing item that i put in one panel as item:



var learningItemsFront = {
style : 'background: url("img/background.png")',
title: "card",
html: '<div id="showCardCreate"><img class="intro" src="img/learningWordsBig.png"/></div><section><details>Keistas</details></section></div>',
listeners: {
scope: this,
swipe: {
element : 'body',
fn: function(){
console.log('Now swiped');
}
},
tapstart: {
element: 'body', //element: 'el', //bind to the underlying el property on the panel
fn: function(){
console.log('2Should now slide');
rootPanel.setActiveItem(learnPanel,
{
type: 'slide',
});
$('details').text('hello');
}
},
}


Solution for swipe/click:
I used:


'render': function(panel) {
panel.getEl().on({
'click': function() {alert("clicked")
},
'swipe':function() {alert("here");
}
})

},