简体   繁体   中英

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

I am using the following code to display a sencha panel. What I am trying to do is pull content from a CMS using json. Everything I try to get the response to populate 'html:' fails. Maybe I just don't understand the scope?

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

});

You need to use :

 YourPanel.update(response.responseText);

inside the success function

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM