Hello all, any help for a nubee greatly appreciated.
I am passing data successfully to a view via the following code:
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 in a tpl using the initialize function, however i would like to access that data inside of the 'video' xtype as well in order to set the 'url' and 'posterUrl' correctly. See the commented sections for where i am accessing the data that was passed to the following panel:
Code:
Ext.define('myapp.view.panel_VideoPlayer', {
extend: 'Ext.Panel',
xtype: 'page_videoplayer',
requires: [
'Ext.Video'
],
// I CAN APPLY THE DATA SUCCESSFULLY TO TPL BELOW USING THIS FUNCTION
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? THIS OBVIOUSLY NOT CORRECT
this.setUrl('http://myurl/'+record.getData('videofile'));
this.setPosterUrl('http://myurl/'+record.getData('videothumb'));
}
}
}
]
},
{
xtype:'panel',
tpl:[
// VIA THE INITIALIZE FUNCTION ABOVE I AM ABLE TO ACCESS THE DATA SUCCESSFULLY HERE
'Title: {videotitle}</br>',
'User: {username}</br>',
'Rating: {videorating}</br>',
'Views: {videoviews}',
'',
''
].join(''),
flex:1
}
]
}
});