Sencha touch 2.0 cihazında yeniyim. Bir html dosyası var. Bu html dosyasını (veya içeriği) bir panele yüklemeye çalışıyorum. Ben sadece ajax çağrısı kullanıyorum ama çalışmıyor. Aşağıdaki kod.html dosyasını bir panele yükleyin
Bu, tarayıcıda çalıştırdığım html dosyasıdır.
index.html:
Ext.setup({
name : 'SampleLoad',
requires : ['HTMLPanel'],
launch : function() {
var HTMLPanel = new HTMLPanel({
scroll : 'vertical',
title : 'My HTML Panel',
url : 'sample.html'
});
}
});
ve HTMLPanel.js olup:
<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>
bu app.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
});
Sadece html içeriğinin panelde görüntülenmesini istiyorum. Birisi yardım edebilir mi?
Ben çalışıyor bu :) benim için çok çalıştı rdougan, cevap – roozbubu