-
23 May 2012 1:37 AM #1
Unanswered: Use Record after onItemDisclosure
Unanswered: Use Record after onItemDisclosure
Hello again,
I have an issue to use the Record after the listener event: onItemDisclosure
I do as follows, where I call the onItemDisclosure:
In the Controller-File I commit the record for the new View (DetailView) like this:Code:this.fireEvent('detailCommand', list, record, index);
After that, I can use the RecordData in the DetailView like this:Code:var xdetail = this.getDetail(); xdetail.setRecord(record);
But when I want to use the RecordData in another way that with 'textfield' and name: 'NameOfData' I wont get anything.Code:var city = { xtype : 'textfield', name : 'City', label : 'City', labelWidth : '', readOnly : true };
I tried it many ways but I just wont get the Data. Right now I'm trying like this:
When I put the value "City: 'bla'" into the data field, I get the field, but else I only see 'City' in the View. I Tried without the data-block but then I have a blank Page.Code:var content = { xtype : 'container', data : {}, tpl : Ext.create('Ext.XTemplate', '<div><b>City</b> {City}</div>') };
I bet its real beginner stuff, but I dont find anything useful in this Forum or on Google..
Shouldnt I be able to get the Record Data like this or equal to it:
Code:this.getRecord().get('City')
-
24 May 2012 2:25 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,581
- Vote Rating
- 433
- Answers
- 3100
Is all you are doing is firing an event in the onItemDisclosure function?
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.
-
24 May 2012 9:29 PM #3
Well.. I'm not sure what u mean bei 'all I do' so I show u the complete lines that get run through when the Event ist fired:
In the List-Object the Listener ist defined as following:
Where later in the same File its fired like this:Code:listeners : { disclose : { fn : this.onListDisclose, scope : this } }
and all that happens in the Controller-File is this:Code:onListDisclose : function(list, record, target, index, evt, options) { this.fireEvent('detailCommand', list, record, index); },
aaaaand this:Code:detailCommand : "onDetailCommand",
This is all what happends after the Disclosure-Event.Code:onDetailCommand : function(list, record, index) { var xdetail = this.getDetail(); xdetail.setRecord(record); list.select(index, true, false); //In the same Step I select the Item on which the Even fired Ext.Viewport.animateActiveItem(xdetail, { type : 'slide', direction : 'left' },); },
-
25 May 2012 3:58 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,581
- Vote Rating
- 433
- Answers
- 3100
Why not do everything in the disclose event listener onListDisclose? Why have one event listener fire another event?
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.
-
25 May 2012 4:08 AM #5
I had the condition to implement it in MVC-Pattern so everything goes through controller. But shouldnt it work like that too?
The Data is not lost, when I make a TextField with the name: 'DataName' it contains the right information.
And wouldnt it be the same Problem when I make everything in the Event?
It's my first Sencha Touch App so, should I do it without the Controller-File? Or at least the Disclosure-Event without?
-
25 May 2012 4:18 AM #6Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,581
- Vote Rating
- 433
- Answers
- 3100
It should but the disclose event is listenable from the controller.
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.
-
25 May 2012 4:33 AM #7
So.. what should I do? Build it, that everything happens in the Disclose-Event?! Should it work like that? Or is there another way?
-
25 May 2012 4:47 AM #8Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,581
- Vote Rating
- 433
- Answers
- 3100
Just use the disclose event in the controller, you don't need to fire a custom event, it's wasteful.
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.
-
25 May 2012 4:58 AM #9
You mean, this one is too much:
?Code:this.fireEvent('detailCommand', list, record, index);
But how do I send the Event to the Controller without it?
Do i 'grab' the Disclose-Event with "disclose" in the controller? And do I remove the 'fn' and 'scope' part then? Or do I have to give this Event some kind of ID?
Sorry :/ It feels like this all should be obvisous :/Code:listeners : { disclose : { fn : this.onPlatesListDisclose, scope : this } }
-
25 May 2012 5:01 AM #10Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,581
- Vote Rating
- 433
- Answers
- 3100
Listen to the disclose event from the controller
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.


Reply With Quote