Results 1 to 3 of 3

Thread: how to refresh a list using a data store with the ajax proxy without new

  1. #1
    Ext User
    Join Date
    Aug 2010
    Posts
    4
    Vote Rating
    0
      0  

    Default how to refresh a list using a data store with the ajax proxy without new

    Hi Folks,
    I'm cloning the kiva LoanList example and I'm able to load the list from using an Ajax proxy. The rub is that if I want to reload with a new URL, the only way I can figure out to do it is with a new data data store, ie this.store = new Ext.data.store() etc. Unless I'm missing something, I'm not seeing the load() or reload(). I see older references to reload(params{}) but I can't get them to work. Any pointers? Snippet below:

    Code:
      filterResults: function (filterBar, values) {
            //alert("DJH reload offer list here");
    
            function doReefresh(request, success) {
                if (success) {
                    this.refresh();
                } else {
                    alert("Search request failed");
                }
            }
    
            this.store = new Ext.data.Store({
                model: 'Offer',
                sorters: [{
                    field: 'title'
                }],
                proxy: {
                    type: 'ajax',
                    //url: getSearchURL(),
                    url: 'http://localhost/php/sencha/examples/digisearch/list1.json',
                    //url: 'http://dev.jugger.com/digipowers/phone/digisearch/list.json',
                    //url: '/list.json',
                    reader: {
                        type: 'json',
                        root: 'offers'
                    },
                    // DJH question, why is this.refresh() not in scope?
                    //afterRequest: doRefresh(request, success)
                    
                    afterRequest: function (request, success) {
                        if (success) {
                            // this.refresh() is not in scope?
                            //this.refresh();
                        } else {
                            alert("Search request failed");
                        }
                    } 
    
                },
                autoLoad: true,
                listeners: {
                    scope: this,
                    datachanged: function () {
                        alert('4');
                        //DJH this refresh is accessible this.refresh();
                    }
                }
            });
    
            // DJH, this is worthwhile, but being called to early.
            this.refresh();
    
            //        //
            //        // DJH this doesn't work
            //        //
            //        // http://tdg-i.com/325/ext-js-screencast-data-stores-and-gridpanels
            //        this.store.proxy.api.read.url = 'http://localhost/php/sencha/examples//list1.json'
            //        this.store.reload();
            //        // DJH Neither does this
            //        this.store.reload({
            //            model: 'Offer',
            //            sorters: [{
            //                field: 'title'
            //            }],
            //            proxy: {
            //                type: 'ajax',
            //                url: 'http://localhost/php/sencha/examples/list1.json',
            //                reader: {
            //                    type: 'json',
            //                    root: 'offers'
            //                }
            //            },
            //            listeners: {
            //                scope: this,
            //                datachanged: function () {
            //                    alert('4');
            //                }
            //            }
            //        }
            //        );
    
    
        }

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,608
    Vote Rating
    874
      0  

    Default

    Code:
    store.proxy.url = 'foo';
    store.read();
    Evan Trimboli
    Twitter - @evantrimboli

  3. #3
    Ext User
    Join Date
    Aug 2010
    Posts
    4
    Vote Rating
    0
      0  

    Default

    works great! thanks a bunch.

Similar Threads

  1. Ajax.request VS Store proxy
    By merry andrew in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 23 Aug 2010, 4:09 PM
  2. Ajax Proxy/Json Store
    By eldiego34 in forum Sencha Touch 1.x: Discussion
    Replies: 2
    Last Post: 19 Aug 2010, 4:59 AM
  3. ComboBox store and refresh list
    By sunco in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 25 Feb 2010, 1:53 PM
  4. is data proxy is the same as ajax?
    By ratno in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 24 Nov 2008, 8:35 AM
  5. add id to Store proxy for combo list
    By bhomass in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 21 Oct 2007, 5:57 PM

Posting Permissions

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