Results 1 to 3 of 3

Thread: AJAX return panel for display

  1. #1

    Question AJAX return panel for display

    Hi all,

    I'm after a little bit of advice and guidance. I have been using Extjs for a little while now and have used the AJAX functionality to submit values and handle returned data. I would like to know if it is possible to make an AJAX/server call to return a new Ext panel for display in another panel.

    A good example would be a shopping cart system where a user would click on a product and the product's details would be displayed. As there are a multitude of different products all with different properties a fixed screen would not be adequate. So, I'm thinking I could send the product values to the server side script which would build the required screen and return it for display replacing the product list view.

    I hope this makes sense. If anyone knows of any good tutorials or how I can do this I would be extremely grateful.

    Cheers

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    Code:
    var ct = new Ext.Panel({
        width: 400,
        height: 400,
        renderTo: document.body,
        tbar: [{
            text: 'Load Panel',
            handler: function(){
                Ext.Ajax.request({
                    url: 'url',
                    success: function(response){
                        var o = Ext.decode(response.responseText);
                        // assumes the Ajax request returns: 
                        // {title: 'Foo'}
                        ct.add(o);
                        ct.doLayout();
                    }
                });
            }
        }]
    });
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3

    Default

    Thanks Evan that's great. I can now build a serverside screen builder to do what I need.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •