-
20 Mar 2012 7:47 AM #1
Answered: Get "Disclose" action without icon in list and with full list item as button
Answered: Get "Disclose" action without icon in list and with full list item as button
I have followed along with the Intro to List Component tutorial and constructed my list and detail pages following the examples presented there. However, rather than just having the icon act as a button, I would like the whole list item to be targetable, and I would like not to see the arrow icon at the right side of the item.
Perhaps I am missing out on some sort of core concept about what it means to "disclose," or about how the disclose event works as opposed to the itemtap event. But I think would prefer to use itemtap. However simply setting onItemDisclosure: to false and changing disclose to itemtap in the controller seems not to work and causes errors.
Any guidance would be appreciated.
Thanks,
David
-
Best Answer Posted by shivbhaw
when you use disclosure, the event sends back certain arguements, and it doesnt matter what the names are in your functions arguements, it will send it back in a certain order.
for the disclosure event, the record of the data is the second arguement, and in itemtap, it is the fourth arguement.
to check the arguements, look at the event for the component, they state it there in order.
so to fix this, you have to change your function intoshowDetail: function (list, index, item, record) or showDetail: function (a,b,c, record)just as long as record is the fourth arguement.
hope this helps!
-
20 Mar 2012 7:50 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,118
- Vote Rating
- 453
- Answers
- 3160
Why not just use the itemtap event then?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
20 Mar 2012 8:33 AM #3
When I do swap out "disclose" for "itemtap" in the controller (shown below), the "record.fullName()" function below causes the error "Uncaught TypeError: Object X has no method 'fullName'." (fullName() simply concatenates a first name and a last name field. The function is defined in the model.) If I simply swap this for "title: record.birdName" I get no error but the detail page shows no data at all and has no title.However simply setting onItemDisclosure: to false and changing disclose to itemtap in the controller seems not to work and causes errors.
From the controller:
In the docs the disclose and itemtap events seem to pass the same parameters, so I am confused as to why I cannot substitute one for the other.Code:config: {refs: {birdholder: 'birdholder'}, control: {'birdlist': {disclose: 'showDetail'}}}, showDetail: function (list, record) {this.getBirdholder().push({xtype: 'birddetail',title: record.fullName(),data: record.data})}
Thanks again for your help,
David
-
21 Mar 2012 5:05 AM #4
when you use disclosure, the event sends back certain arguements, and it doesnt matter what the names are in your functions arguements, it will send it back in a certain order.
for the disclosure event, the record of the data is the second arguement, and in itemtap, it is the fourth arguement.
to check the arguements, look at the event for the component, they state it there in order.
so to fix this, you have to change your function intoshowDetail: function (list, index, item, record) or showDetail: function (a,b,c, record)just as long as record is the fourth arguement.
hope this helps!
-
21 Mar 2012 5:50 AM #5
Perhaps because I am somewhat new to JS & Sencha, this was something of a revelation to me. Thank you so much for this clarification!the event sends back certain arguements, and it doesnt matter what the names are in your functions arguements, it will send it back in a certain order.


Reply With Quote