Hybrid View

  1. #1
    Sencha User
    Join Date
    Jul 2010
    Posts
    33
    Answers
    1
    Vote Rating
    0
    charles.bourasseau is on a distinguished road

      0  

    Default Answered: Extjs Tree Store auto sync with server

    Answered: Extjs Tree Store auto sync with server


    Hi,

    how to use store to sync with server when using a Tree ?

    I tried to use TreeStore but it does not have any appendChild oder addChild.
    NodeInterface has a appendChild method but it does not sync with the server trough the store or proxy...

    Any ideas ?

  2. Which version do you use? TreeStore.autoSync has effect only from Ext 4.1.

  3. #2
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    1. You add records into TreeStore through its nodes. The following example shows how to add a node into root node.
    Code:
    treestore.getRootNode().appendChild({text: 'node', leaf: true....});
    2. To sync TreeStore to with server, you use treestore.sync() or set its autoSync to true to automatically sync.

  4. #3
    Sencha User
    Join Date
    Jul 2010
    Posts
    33
    Answers
    1
    Vote Rating
    0
    charles.bourasseau is on a distinguished road

      0  

    Default


    It works actually very well.

    I just have a problem because the autoSync does not work even though it's set to true...

    var store = Ext.getStore('MyStore');
    store.getNodeById(id).remove(); // No Ajax here
    store.sync(); // Ajax..
    I also tried destroy(), but it produces an error and I can't figure out which line produces it:

    TypeError: Cannot call method 'indexOf' of undefined

  5. #4
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    Below is my fix in removing a node.
    Code:
    var store = Ext.getStore('MyStore');
    // store.getNodeById(id).remove(); // No Ajax here
    var node = store.getNodeById(id);
    node.parentNode.removeChild(node);
    store.sync(); // Ajax..

  6. #5
    Sencha User
    Join Date
    Jul 2010
    Posts
    33
    Answers
    1
    Vote Rating
    0
    charles.bourasseau is on a distinguished road

      0  

    Default


    I works, but it's not autoSync

    I would like to have autoSync

  7. #6
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    Which version do you use? TreeStore.autoSync has effect only from Ext 4.1.

Thread Participants: 1

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