1. #1
    Sencha User
    Join Date
    Jan 2012
    Location
    Rennes - France
    Posts
    172
    Answers
    2
    Vote Rating
    1
    Thierryg is on a distinguished road

      0  

    Default Unanswered: How to add/remove entry related to a store.

    Unanswered: How to add/remove entry related to a store.


    Hi,

    I have a list feed by a store from a local json.

    I wanna know how to remove an entry from my store. Because it is feed by a json file, does it will update the json ? and once the json is update how to refresh/synchronize my list ?

    Same question for adding one entry, in the json file, then refreshing the list.

    Here is the source code i am using for creating the store :

    Code:
            // -----------------------------------------
            // ----- Create a live profile's store -----
            // -----------------------------------------
            Ext.define('LiveProfileModel',
            {
                extend: 'Ext.data.Model',
                config:
                {
                    fields:
                    [
                        { name: 'id',    type: 'int'    },
                        { name: 'name',  type: 'string' },
                        { name: 'delay', type: 'int'    }
                    ]
                }
            });
            LiveProfileStore = Ext.create('Ext.data.Store', { model: 'LiveProfileModel' });
            LiveProfileStore.setData(dmngConfig.liveProfile);
    And the code need for the list :

    Code:
    {
                        title: 'LstLive',
                        layout: 'vbox',
                        padding: 10,
                        items:
                        [
                            {
                                title:   _strings_live_liveprofilelisting[dmngConfig.deviceLanguageID],
                                xtype:   'list',
                                itemTpl: '{name} (delay:{delay})',
                                store:   LiveProfileStore,
                                listeners:
                                {
                                    itemtap: function(record, index)
                                    {               
                                        //console.log("record="+record+" - index="+index);
                                        //console.log(record);
                                        console.log("[LIVE] id="    + dmngConfig.liveProfile[index].id);
                                        console.log("[LIVE] name="  + dmngConfig.liveProfile[index].name);
                                        console.log("[LIVE] delay=" + dmngConfig.liveProfile[index].delay);
                                        localStorage['liveprofileid']    = dmngConfig.liveProfile[index].id;
                                        localStorage['liveprofilename']  = dmngConfig.liveProfile[index].name;
                                        localStorage['liveprofiledelay'] = dmngConfig.liveProfile[index].delay;
                                        liveview.push(2);
                                    }
                                }
                            }
                        ]
                    }

    Thanks in advance.

    Regards

  2. #2
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Answers
    93
    Vote Rating
    6
    rdougan will become famous soon enough

      0  

    Default


    You shouldn't access localStorage directly, use the Store methods instead.

    http://docs.sencha.com/touch/2-0/#!/api/Ext.data.Store

    Most importantly, add/remove.
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

Thread Participants: 1

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