1. #1
    Sencha User
    Join Date
    Feb 2012
    Location
    Mercer Island, WA
    Posts
    66
    Vote Rating
    0
    DonRul is on a distinguished road

      0  

    Default How to force an Ext.dataview.List to refresh

    How to force an Ext.dataview.List to refresh


    I have a list bound to a Store that is updated by an Ajax query. After the store is refreshed I update one field in the record by looking it up in another store:

    PHP Code:
        onJsonstoreRefresh: function(storedataeOpts) {
            var 
    drugStore Ext.data.StoreManager.lookup('DrugNameStore');
            if (
    store.getCount() > 0) {
                
    store.each(function(rec){
                    
    drugRec drugStore.findRecord("RXCUI"rec.data.RXCUI);
                    if (
    drugRec)
                    
    rec.DrugName drugRec.data.DrugName1;
                });
            }
        } 
    When I am done the store is correctly populated but the List has the old values for DrugName (null). I think that I need to fire a store event to get the list to refresh but not able to find the right syntax.

    I suspect that I need to fire an event but which event and how to format the options is not clear to me.

  2. #2
    Sencha - Architect Dev Team jjohnston's Avatar
    Join Date
    Sep 2010
    Posts
    516
    Vote Rating
    17
    jjohnston will become famous soon enough jjohnston will become famous soon enough

      0  

    Default


    This doesn't sound like an Architect question, but it seems to me that you need to set the new value using the model record's 'set' method, which should trigger the correct internal events for the list to be notified.

    rec.set('DrugName', drugRec.data.DrugName1);

    If this doesn't help, I'd suggest posting this question in the Sencha Touch forums as the users there will be better equipped to answer your question.
    Jason Johnston
    @lojjic
    Sencha Architect Development Team

  3. #3
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    28
    Vote Rating
    0
    Edward Lu is on a distinguished road

      0  

    Default


    Ext.getStore('storeName').removeAll();

  4. #4
    Sencha User
    Join Date
    Feb 2012
    Location
    Mercer Island, WA
    Posts
    66
    Vote Rating
    0
    DonRul is on a distinguished road

      0  

    Default


    It turns out that I didn't need to refresh the store, I just need to put the data in the right place. Notice in the above:
    Code:
    rec.DrugName = drugRec.data.DrugName1;
    
    should be
    Code:
    rec.data.DrugName = drugRec.data.DrugName1;
    
    If you catch the refresh event at the Store and update records a list bound to the Store will see the updates. This is effectively what jjohnson's solution would do.

    Thanks,
    Don

  5. #5
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,176
    Vote Rating
    119
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Don - rather than setting the data attribute directly, I suggest you use the set method as Jason has suggested above.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

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