我正在开发一个Sencha Touch应用程序,其中我正在做很多Ext.extend
并创建我自己的自定义组件和类。我对Sencha Touch领域相对来说比较陌生,在尝试使用Ext.XTemplate
中的某个组件时,我遇到了一些问题。下面是我想要的一些代码做一个概念:在XTemplate中包含一个Sencha组件
MyObj = Ext.extend(Ext.Panel, {
cls: 'myClass',
layout: 'card',
scroll: 'vertical',
monitorOrientation: true,
config: myConfigObject.localObjectType,
loc: 'en_US',
initComponent: function() {
// some random init code here…
// Including:
var tpl = new Ext.XTemplate(
'<tpl for=".">',
'<tpl if="Available === true"><div class="itemAvail"></tpl>',
'<tpl if="Available !== true"><div class="itemNotAvail"></tpl>',
'<div class="formText">',
// INSERT MY VIDEO COMPONENT HERE…
'</div>',
'</div>',
'</tpl>',
{ compiled : true }
);
},
// Object definition continues, but I don't think it's germane to this discussion…
});
Ext.reg('videoList', MyApp.views.VideoList);
而现在,我需要上面包括了我的视频色差半码:
MyVideoComponent = Ext.extend(Ext.Panel, {
programID: null,
chapterID: null,
video: null,
videoPlayer: null,
initComponent: function() {
var progID = this.programID;
var chapID = this.chapterID;
// Set up the video object based on progID and chapID
this.videoPlayer = new Ext.Video({
id: "videoPlayer",
url: video.URL,
posterURL: video.posterURL,
fullscreen: true,
autoResume: true,
// configure listeners for play/end/error
});
// Call superclass.initComponent()
},
// Create listener callbacks for onPlay, onEnded, onError…
});
Ext.reg('videoComponent', MyApp.components.VideoComponent);
没有人有任何的想法我怎么能做到这一点?
谢谢!
我认为最好是直接将播放器添加到项目中,而不是在其中使用XTemplate(顺便说一句,XTemplate总是被编译,不需要设置该配置选项),如果你想拥有,可以说,一个视图缩略图,那么你应该扩展DataView而不是Panel。 – VoidMain