PDA

View Full Version : Ext.List: on component touched event



cmygeHm
20 Jul 2011, 2:08 AM
Helllo world! :)

Help me please. I can not understand how do it: I have to lists on my page and if one of them have were touched I want switch value of flag in my page. E.g.:


var flag= 'left';

leftList = new Ext.List({
listeners: {
activate: {
element: 'body',
fn: function() {
flag='left';
}
}
}
});
rightList = new Ext.List({
listeners: {
activate: {
element: 'body',
fn: function() {
flag='right';
}
}
}
});



But this code is not works. Thank you. Excuse me for my English.

cmygeHm
20 Jul 2011, 10:50 PM
Hey! Can somebody help me??

art.dev.ext
21 Jul 2011, 4:28 AM
Maybe :

listeners: {
element: 'body',
activate: function() {
flag='left';
}
}

cmygeHm
21 Jul 2011, 10:09 PM
No, it is not works.

cmygeHm
24 Jul 2011, 10:20 PM
Hey! Can somebody help me??

jjerome
25 Jul 2011, 8:05 AM
try the "itemtap" event instead of "activate"

cmygeHm
28 Jul 2011, 12:08 AM
try the "itemtap" event instead of "activate"



listeners: {
itemtap: {
element: 'el',
fn: function(){
listTouched();
}
}
}


and




listeners: {
itemtap: {
element: 'body',
fn: function(){
listTouched();
}
}
}


doe's not works. It's like a fortune-telling :( In Sench API writed:
activate : ( Ext.Component this )
Fires after a Component has been visually activated.
Listeners will be called with the following arguments:

jjerome
28 Jul 2011, 9:12 AM
That is not how you set up the itemtap function. I assumed too little.

Use this code instead of what you have now:




listeners: {
itemtap: function(dv, idx, itm, e) {
//do stuff here
}
}

cmygeHm
29 Jul 2011, 6:10 AM
Thank you. But it fired only on item touch. I want know that user scrolls list, it is another event. I tried "move" event, but is is not works.

jjerome
29 Jul 2011, 6:28 AM
Look at the API for Ext.List:

http://dev.sencha.com/deploy/touch/docs/?class=Ext.List

You'll see the events you can use.

cmygeHm
1 Aug 2011, 12:46 AM
Look at the API for Ext.List:

http://dev.sencha.com/deploy/touch/docs/?class=Ext.List

You'll see the events you can use.


Have I said that I use API every time ? I can not understand some sentences in English. And there are events which may be can helps me: itemswipe, itemtap, move. But they are not works as I expect from them.

Zdeno
1 Aug 2011, 1:52 AM
Im not sure if it is what u really want but "focus" is the right function.. problem is focus dont work for me on the list :( But i think u can use itemtap to indicate focus on the list component.

cmygeHm
1 Aug 2011, 3:24 AM
Im not sure if it is what u really want but "focus" is the right function.. problem is focus dont work for me on the list :( But i think u can use itemtap to indicate focus on the list component.


Itemtap works on LIST COMPONENT, but I want know when anything element, any part of this component will be touched :(

Zdeno
1 Aug 2011, 1:54 PM
Whats your hierarchy of components? Post example pleas =) really dont know why do u need check any other element.. im using list with fullscreen property only.

cmygeHm
1 Aug 2011, 10:27 PM
Whats your hierarchy of components? Post example pleas =) really dont know why do u need check any other element.. im using list with fullscreen property only.


I want to do online two panels file browser for touch screen. And I want activate panel and know what panel is active now.

cmygeHm
4 Aug 2011, 1:00 AM
Anybody can help me? The question is alive.

Zdeno
8 Aug 2011, 6:37 AM
new Ext.Panel({
fullscreen: true,
layout: {
type: 'hbox'
},
flex: 1,
items: [{
xtype: 'list',
itemTpl : '1 {firstName} {lastName}',
flex: 1,
store: store,
listeners: {
//Fires when a tap occurs and it is not on a template node.
containertap : function(view, e) {
console.log('activate 1');
},
//Fires when a node is tapped on
itemtap : function( view, index, item, e ) {
console.log('activate 1');
}
}
},{
xtype: 'list',
itemTpl : '2 {firstName} {lastName}',
flex: 1,
store: store,
listeners: {
//Fires when a tap occurs and it is not on a template node.
containertap : function(view, e) {
console.log('activate 2');
},
//Fires when a node is tapped on
itemtap : function( view, index, item, e ) {
console.log('activate 2');
}
}
}]
})

cmygeHm
9 Aug 2011, 12:12 AM
Thank you! Now I will try it.