PDA

View Full Version : Pressing a disclosure button also triggers the itemtap event



wdonne
1 Mar 2011, 10:06 AM
Hi,

Setting different handlers for the "disclosure" and "itemtap" events on a list doesn't work because both are called when the disclosure button is pressed.

Best regards,

Werner Donné.

art.home.ext
4 Mar 2011, 2:20 PM
you are right with 1.0.1a

as a workaround, you can check event target :

if (e.getTarget('.x-list-item-body') ) {
console.log("itemt tap!");

} else {
console.log("disclosure!");
}

wdonne
7 Mar 2011, 10:16 AM
Thank you for the workaround.

Werner.

thomas.romera
2 Sep 2011, 4:25 AM
Hello,

this bug is also on 1.1.0.

i add : Your trick did it to me, but sometimes when tap on event, the disclose also triggers. Don't know how to fix it.

epiphanydigital
3 Oct 2011, 7:23 AM
Where is "e" defined in this scenario?

thomas.romera
3 Oct 2011, 7:39 AM
On the Sencha touch Doc :

(http://dev.sencha.com/deploy/touch/docs/source/List.html#event-Ext.List-disclose) Disclose : ( Ext.data.Record record, Ext.Element node, Number index,Ext.util.Event e )
So, it's the Event in the Disclose's arguments.

epiphanydigital
3 Oct 2011, 8:56 AM
What I ended up doing:



onItemDisclosure : true,
listeners : {
itemtap : function(record,index,item,e){
if (e.getTarget('.x-list-disclosure')) {
Ext.Msg.alert("Disclosure clicked!");
} else {
Ext.Msg.alert("Item clicked!");
}
}
}


Works great. Thanks guys!

Anyone have any idea how to change the icon????

art.dev.ext
14 Oct 2011, 1:51 AM
Simply add a 'cls' attribute on any .x-list-disclosure's parent (on the Ext.List itself for example)
Then change your .css :

.your-list-cls .x-list-disclosure {
-webkit-mask: none;
background-image: url('../img/trashcan.png') !important;
background-size: 100% 100%;
-webkit-background-size: 100% 100%;
background-color: transparent !important;
background-repeat: no-repeat;
background-position: center;
width: 2em;
height: 2em;
}

epiphanydigital
14 Oct 2011, 4:36 AM
Thanks!

sathyan_8294
31 Oct 2011, 9:40 PM
i want to display details of selected record in next page without a pressing a disclosure button

epiphanydigital
1 Nov 2011, 4:36 AM
Do something like...



onItemDisclosure: true,
listeners : {
itemtap : function(record,index,item,e) {
if (e.getTarget('.x-list-disclosure')) {
// do something with the disclosure tap
} else {
var currentRecord = record.store.getAt(index);
App.SomePanel.update(currentRecord.data);
}
}
}

gopikumar
29 Nov 2011, 4:51 AM
Do something like...



onItemDisclosure: true,
listeners : {
itemtap : function(record,index,item,e) {
if (e.getTarget('.x-list-disclosure')) {
// do something with the disclosure tap
} else {
var currentRecord = record.store.getAt(index);
App.SomePanel.update(currentRecord.data);
}
}
}




Hi epiphanydigital,

Hi

Thanks!!

Even i am dealing with the same issue.

Here the selected item value in the list is displayed in next panel.

how to setValue in a textbox.

Actually i have a textbox on the top, by selecting item in the list it should able to set the value.

I tried with




listeners : {
itemtap : function(record,index,item,e) {


var currentRecord = record.store.getAt(index);
//alert('Disclose more info for ' + currentRecord.get('firstName'));
console.log('tap event '+ currentRecord.get('firstName'));
Mypanel.dockedItems.textBox.setValue(currentRecord.get('firstName'));

}




But its not working.

Any help appreciated.

epiphanydigital
29 Nov 2011, 6:41 AM
Do you have your store set?
Can you check your javascript developer console and see if there are json objects stored?
The if/else conditional in my example above is required if you want to separate the two events... you may not be trying to do that, but throwing it out there.
Try logging to console this instead:



console.log('tap event', currentRecord);


...just to make sure you're getting the right object and that it's populated. You may already see if it is or not, I can't see your output.

You may also need to call the following function:



Mypanel.doComponentLayout();

gopikumar
29 Nov 2011, 9:10 PM
Ok thank you so much for your suggestions.
It is fetching the right record and displaying in console.


I tried with






Ext.getCmp('searchBox').setValue(currentRecord.get('firstName') );







and now working.

Manoj Parida
23 Oct 2012, 3:09 AM
Is there any good tricks,that we have to handle both these events separately.
Means
disclose : function( this, record, target, index, e, eOpts
) {
this.fireEvent('discl', this, record, target, index, e, eOpts );
},
itemtap: function(this, index, target, record, e, eOpts
){

this.fireEvent('itemtp', this, index, target, record, e, eOpts
);
}



Is this possible in sencha touch 2 ?


Regards
Manoj Parida