私はsencha touch 2.0を初めて使用しています。私はhtmlファイルを持っています。このhtmlファイル(またはコンテンツ)をパネルに読み込もうとしています。私は単にajax呼び出しを使用していますが、動作しません。以下はコードです。htmlファイルをパネルにロード
これは私がブラウザで実行しているhtmlファイルです。
index.htmlを:
<script type="text/javascript" src="touch/sencha-touch-debug.js"></script>
<script type="text/javascript" src="HTMLPanel.js"></script>
<script type="text/javascript" src="app.js"></script>
このapp.jsある:
Ext.setup({
name : 'SampleLoad',
requires : ['HTMLPanel'],
launch : function() {
var HTMLPanel = new HTMLPanel({
scroll : 'vertical',
title : 'My HTML Panel',
url : 'sample.html'
});
}
});
これはHTMLPanel.jsある:
//HTMLPanel = Ext.extend(Ext.Panel, { //gives error
var HTMLPanel = Ext.define('HTMLPanel',{
extend : 'Ext.Panel',
constructor : function(config) {
HTMLPanel.superclass.constructor.apply(this, arguments);
// load the html file with ajax when the item is
// added to the parent container
this.on(
"activate",
function(panel, container, index) {
if(this.url && (this.url.length > 0))
{
Ext.Ajax.request({
url : this.url,
method : "GET",
success : function(response, request) {
//console.log("success -- response: "+response.responseText);
panel.update(response.responseText);
},
failure : function(response, request) {
//console.log("failed -- response: "+response.responseText);
}
});
}
},
this
)
},
url : null
});
私は、htmlコンテンツをパネル内に表示したいだけです。助けてもらえますか?
これが動作していることを確認できます。受け入れる必要があります。 – roozbubu