Sencha Touch 1.1使用Ajax返回的内容填充Ext.panel.html

Sencha Touch 1.1 populate Ext.panel.html with Ajax returned content

本文关键字:填充 Ext panel html Touch 使用 Ajax 返回 Sencha      更新时间:2023-09-26

我正在使用以下代码来显示一个sencha面板。我正在尝试使用json从CMS中提取内容。我试图获得填充"html:"的响应的所有操作都失败了。也许我只是不明白范围?

App.views.howAttend = Ext.extend(Ext.Panel, {
initComponent: function () {
    var resp = Ext.Ajax.request({
        scope: this,
        url: 'mobile-request/pages/how-attend',
        success: function ( response ) {
            var obj = Drupal.parseJson( response.responseText );
            console.log(obj); // this is as expected
                            //this.html = obj.data doesn't work, neither does using obj.data below, in html:
        },
        failure: function ( response ) {
            console.log (' server error ' + response.status);
        }
    })
    //console.log(this);
    App.views.howAttend.superclass.initComponent.call(this);
},
html: 'Nothing'// need to get html returned to here

});

您需要使用:

 YourPanel.update(response.responseText);

在成功函数内部