1. #1
    Sencha User
    Join Date
    Oct 2012
    Location
    Toulouse
    Posts
    58
    Answers
    7
    Vote Rating
    0
    novadys-sbu is on a distinguished road

      0  

    Default Answered: Store loading problem

    Answered: Store loading problem


    Hello peeps !

    I have a problem getting my store to load after I get a JSON string from a PHP servlet.
    My situation is : I have two panels - one with a search form in it, the other with a dataview where I would like to render the results I get.

    On submit of the form, I perform a AJAX request from my search controller like so :
    Code:
    control : {
                confirmButton:{
                    tap: function(list, index, element, record){                                                        
                        var myQueryConn = Ext.create('Ext.data.Connection');
                        myQueryConn.request({
                            params: {             
                                'bGetQuery' : 1,
                                'bDecodeUTF8' : 1,
                                'bReverseCatLevels' : 1,
                                'strArchiveReference' : Ext.getCmp('strArchiveReference').getValue(),
                                'strFullText' : getSearchParams()
                            },
                            url:'servlets/search.php',
                            timeout:MAX_EXECUTION_TIME,
                            method:'POST',
                            success:function(response) {                              
                                Ext.getStore('Results').load();  //end of load                                            
                            },
                            failure:function(responseObject) {
                                processResponseError(responseObject.status, 'searchArchive.php');
                            }
                        });                                
                    }           //End of tap 
                }            
            }
    And I get a JSON which looks like this :

    Code:
    {'totalCount':2,'rows':[{"id":"11","Host":"I-DEV-SBU","Path":"","SourceHost":"I-DEV-SBU","SourcePath":"Bonzai.pdf","DepotId":"1001","DepotKey":"00000007.pdf","Parent":"","Username":"","Filename":"","Extension":"","Filedate":"","Filesize":"","Importdate":"","Importtime":"","OCR":"","Fulltext":"","ValueDOC":""},{"id":"8","Host":"I-DEV-SBU","Path":"","SourceHost":"I-DEV-SBU","SourcePath":"Bonzai.pdf","DepotId":"1001","DepotKey":"00000005.pdf","Parent":"","Username":"","Filename":"","Extension":"","Filedate":"","Filesize":"","Importdate":"","Importtime":"","OCR":"","Fulltext":"","ValuePDF":""}]}
    So I like to populate my store from this JSON string using :
    Code:
     Ext.getStore('Results').load();
    However the load does nnot work. I tried a listener 'onLoad' of the store to see if I does anything but it doesn't
    Here is my results view panel :

    Code:
    Ext.define('Ext.ux.results', {
        id: 'results',
        xtype: 'results',
        alias: 'results',
        widget: 'widget.results',
        extend: 'Ext.tab.Panel',
        
        requires: [
            'Ext.TitleBar',
            'Ext.form.*',
            'Ext.field.*',
            'Ext.Button',
            'Ext.data.ArrayStore'
        ],
        config: {        
            defaults: {
                scrollable: true
            },
            items: [
            {
                    xtype:'dataview',                
                    id:'searchResultList',
                    title: 'results',
                    iconCls:'info',
                    store: 'Results',
                    fullscreen: true,
                    disableSelection: true, 
                    displayField:'id', 
                    listConfig:{
                        itemTpl: new Ext.XTemplate('<div>{id}</div>')
                    },                        
                    store: Ext.create('Ext.data.Store', {
                        autoLoad: true,   
                        storeId: 'Results',
                        model:'documind.model.Result',
                        proxy:{ 
                            type:'ajax',
                            url:'servlets/search.php',
                            method: 'POST',
                            reader:{
                                type:'json',                   
                                rootProperty:'rows',
                                totalProperty:'totalCount'
                            }
                        },                    
                        listener: {
                            onLoad: function(){
                                alert("Store has been loaded");
                            }
                        }
                    })
                }
            ]// end of items
        }
    });

    Any help is much appreciated. And I will send a great fat virtual hug to whoever can help me !

    Thankssss
    Sarah

  2. You are misunderstanding the concept how stores load data. You need to trigger the proxy inside your store, in your case like this:

    Code:
    var store = Ext.getStore('Results');
    store.getProxy().setExtraParams({
      'bGetQuery' : 1,
      'bDecodeUTF8' : 1,
      'bReverseCatLevels' : 1,
      'strArchiveReference' : Ext.getCmp('strArchiveReference').getValue(),
      'strFullText' : getSearchParams()
    });
    store.load();

  3. #2
    Sencha User
    Join Date
    Jan 2011
    Posts
    134
    Answers
    6
    Vote Rating
    5
    JRS is on a distinguished road

      0  

    Default Verify JSON returned is valid

    Verify JSON returned is valid


    Hi

    I ran into trouble when doing this - it turned out my JSON was invalid. Please verify it with JSON Lint

    Hope that is the problem

  4. #3
    Sencha User
    Join Date
    May 2012
    Posts
    14
    Answers
    3
    Vote Rating
    1
    svizzini is on a distinguished road

      0  

    Default


    You are misunderstanding the concept how stores load data. You need to trigger the proxy inside your store, in your case like this:

    Code:
    var store = Ext.getStore('Results');
    store.getProxy().setExtraParams({
      'bGetQuery' : 1,
      'bDecodeUTF8' : 1,
      'bReverseCatLevels' : 1,
      'strArchiveReference' : Ext.getCmp('strArchiveReference').getValue(),
      'strFullText' : getSearchParams()
    });
    store.load();

  5. #4
    Sencha User
    Join Date
    Oct 2012
    Location
    Toulouse
    Posts
    58
    Answers
    7
    Vote Rating
    0
    novadys-sbu is on a distinguished road

      0  

    Default Thanks

    Thanks


    Thanks, I knew I wasn't doing something right.
    I'll try this and get back to you

Thread Participants: 2

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi