Please excuse me if this seems like a redundant question, however, i have searched the Sencha Touch QA to no avail. I am a nubee here, so I'm looking for best practice and correct way to do the following. Any specific examples would be ever so greatly appreciated, as i would like to use best practices.
I am passing data from a list view to a detail panel using the following method:
Code:
...
itemtap: function (list, index, target, record) {
...
Ext.Viewport.animateActiveItem (
{xtype: 'page_videoplayer', data: record.data},
{type:'pop'}
);
}
I am able to access that data partially, however i would like to access that data inside of the 'video' xtype in my detail panel in order to set the 'url' and 'posterUrl' correctly ... see the following code ... again any help here greatly appreciated.
This is my detail panel: 'page_videoplayer'
Code:
Ext.define('myapp.view.panel_VideoPlayer', {
extend: 'Ext.Panel',
xtype: 'page_videoplayer',
requires: [
'Ext.Video'
],
initialize:function (){
var panels = this.query('panel[tpl]'),
pLen = panels.length,
p = 0,
panel;
for (p=0; p < pLen; p++) {
panel = panels[p];
panel.setData(this.getData());
}
},
layout: {
type: 'vbox'
},
config: {
title: 'VideoPlayer',
cls: 'bluePanel',
scrollable: true,
styleHtmlContent: true,
items: [
{
items:[
{
xtype: 'video',
itemId: 'vplayer',
title: 'video player',
width: '100%',
height: 200,
listeners: {
activate: function(){
// HOW WOULD I CORRECTLY ACCESS THE DATA HERE? WHAT I AM TRYING IS NOT WORKING
this.setUrl('http://s3.amazonaws.com/cf-templates-1vy0cxj1zsmok-us-east-1/videos_encoded/'+record.getData('videofile')+'.m4v');
this.setPosterUrl('http://s3.amazonaws.com/cf-templates-1vy0cxj1zsmok-us-east-1/videos_encoded/'+record.getData('videofile')+'_0000.png');
}
}
}
]
},
{
xtype:'panel',
tpl:[
// VIA THE INITIALIZE FUNCTION ABOVE I AM ABLE TO ACCESS THE DATA CORRECTLY HERE
'Title: {videotitle}</br>',
'User: {username}</br>',
'Rating: {videorating}</br>',
'Views: {videoviews}',
'',
''
].join(''),
flex:1
},
{
xtype: 'button',
text: 'close',
ui: 'confirm',
action: 'btn_player_close',
cls: 'button_display',
height: 40,
width: 200
}
]
}
});