PDA

View Full Version : How do I access panel data from a button on a navigationvew bar?



senchadriver
23 Oct 2012, 7:19 PM
I'm new to Sencha Touch coming from native obj-c. In my controller, I have the following code below. My panel currently has data set to it from a previous list that's been pushed to the navigationview.<br>
<br>
onRecordingAction: function() {<br>
&nbsp;&nbsp;&nbsp;&nbsp;var actionButton = this.getActionButton();<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;var overlay = new Ext.Panel({<br>
&nbsp;&nbsp;&nbsp;&nbsp;left: 0,<br>
&nbsp;&nbsp;&nbsp;&nbsp;modal: true,<br>
&nbsp;&nbsp;&nbsp;&nbsp;scroll: false,<br>
&nbsp;&nbsp;&nbsp;&nbsp;padding: 10,<br>
&nbsp;&nbsp;&nbsp;&nbsp;id:'actionPanel',<br>
&nbsp;&nbsp;&nbsp;&nbsp;layout: {<br>
&nbsp;&nbsp;&nbsp;&nbsp; type: 'vbox',<br>
&nbsp;&nbsp;&nbsp;&nbsp; align:'center',<br>
&nbsp;&nbsp;&nbsp;&nbsp; pack:'center'<br>
&nbsp;&nbsp;&nbsp;&nbsp;},<br>
&nbsp;&nbsp;&nbsp;&nbsp;items:[<br>
&nbsp;&nbsp;&nbsp;&nbsp; {xtype: 'spacer'},<br>
&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp; xtype: 'button',<br>
&nbsp;&nbsp;&nbsp;&nbsp; ui:'action',<br>
&nbsp;&nbsp;&nbsp;&nbsp; id: 'startRecording',<br>
&nbsp;&nbsp;&nbsp;&nbsp; text: 'Start Recording',<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listeners: {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tap: function() {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var pnl = Ext.getCmp('actionPanel');<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//**** I need to access panel data here<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp; },<br>
&nbsp;&nbsp;&nbsp;&nbsp; {xtype: 'spacer'}<br>
&nbsp;&nbsp;&nbsp;&nbsp;]}).showBy(actionButton);<br>
},<br>
<br>
Any help appreciated.

mitchellsimoens
25 Oct 2012, 6:55 AM
I cannot read your code.

senchadriver
25 Oct 2012, 10:14 PM
showRecordingPanel: function() {
var recordingButton = this.getRecordingButton();


var overlay = new Ext.Panel({
left: 0,
modal: true,
scroll: false,
padding: 10,
id:'actionPanel',
layout: {
type: 'vbox',
align:'center',
pack:'center'
},
items:[
{xtype: 'spacer'},
{
xtype: 'button',
ui:'action',
id: 'startRecording',
text: 'Start Recording',
listeners: {
tap: function() {
var pnl = Ext.getCmp('actionPanel');

// How do you access data from panel here??

}
}
},
{xtype: 'spacer'}
]}).showBy(recordingButton);

},

ingo.hefti
25 Oct 2012, 11:06 PM
It may be clearer if you could provide your panel code / definition as well... At least the part you want to access. Also which version of the SDK are you using?

senchadriver
28 Oct 2012, 12:53 PM
In Controller:


showDetail: function(list, record) {
this.showActionButton();

this.getMain().push({
xtype: 'recordingdetail',
data: record.getData()
})




In another file:


Ext.define('MyRecording.view.RecordingDetail', {
extend: 'Ext.Panel',
xtype: 'recordingdetail',


config: {
title: 'Recording Detail',
styleHtmlContent: true,
scrollable: 'vertical',
tpl: [
'<p>{recordingNo} {category} </p> <p>Recording started: {recDate}'
]
}
});

senchadriver
28 Oct 2012, 12:55 PM
2.0.1.1