Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

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 4.1 tree add new node with server changes

    Answered: extjs 4.1 tree add new node with server changes


    In my application, the user can add some nodes to a tree node. The tree is connected to a store which has autoload and autosync true.The code to add a new node is this one:
    Code:
    var window = button.up('window');
    var form = window.getComponent('NodeForm').getForm();
    var store = Ext.getStore('NodeStore');
    var parentDir = window.parentDir;
    record = window.record ? window.record : NuageApp.model.Node.create();
    
    
    if (form.isValid()) {
        form.updateRecord(record);
        if (window.record) {
            store.sync();
        } else {
            parentDir.appendChild(record);
        }
        window.destroy();
    }
    Then the server will be notified and returns this json:
    Code:
    {
       "id": "4faccf93f597090d14000010/home/user/file",
       "text": "test file",
       "type": "file",
       "icon": "/images/icons/page.png",
       "expanded": true,
       "children": []
    }
    The property text and icon changed server side but the store does not update the record.


    Code:
    Here is the configuration of the store:
    Ext.define('MyApp.store.NodeStore', {
        extend: 'Ext.data.TreeStore',
        requires: [
            'MyApp.model.Node'
        ],
    
    
        constructor: function(cfg) {
            var me = this;
            cfg = cfg || {};
            me.callParent([Ext.apply({
                autoLoad: true,
                autoSync: true,
                storeId: 'MyJsonTreeStore1',
                model: 'MyApp.model.Node',
                proxy: {
                    type: 'rest',
                    reader: {
                        type: 'json',
                        idProperty: 'id'
                    },
                    writer: {
                        type: 'json',
                        nameProperty: 'text'
                    }
                },
                sorters: {
                    property: 'text'
                },
    
    
            }, cfg)]);
        },
    
    
    });



  2. Try to return json data as an array:
    Code:
    [{
       "id": "4faccf93f597090d14000010/home/user/file",
       "text": "test file",
       "type": "file",
       "icon": "/images/icons/page.png",
       "expanded": true,
       "children": []
    }]
    Or
    Code:
    { 
        "success": true,
        "children": [{
           "id": "4faccf93f597090d14000010/home/user/file",
           "text": "test file",
           "type": "file",
           "icon": "/images/icons/page.png",
           "expanded": true,
           "children": []
       }]
    }

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

      0  

    Default


    Would be nice if someone can help

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

      0  

    Default


    I just make a git repository with my specific problem: https://github.com/cbou/extjs-nodejs-tree-panel-test

    It would be nice if someone can take a look

  5. #4
    Sencha User
    Join Date
    May 2012
    Posts
    11
    Answers
    1
    Vote Rating
    0
    kid- is on a distinguished road

      0  

    Default


    I have the same problem. Did you resolve it? Here it is http://www.sencha.com/forum/showthread.php?208484-tree.Panel-drag-n-drop-on-fly-dropped-item-modification

    I think it may be an issue with a difference between data model of treeView and a form. Is your form completely the same as a treeView node model?

  6. #5
    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


    Try to return json data as an array:
    Code:
    [{
       "id": "4faccf93f597090d14000010/home/user/file",
       "text": "test file",
       "type": "file",
       "icon": "/images/icons/page.png",
       "expanded": true,
       "children": []
    }]
    Or
    Code:
    { 
        "success": true,
        "children": [{
           "id": "4faccf93f597090d14000010/home/user/file",
           "text": "test file",
           "type": "file",
           "icon": "/images/icons/page.png",
           "expanded": true,
           "children": []
       }]
    }

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

      0  

    Default


    Thanks vietits your second solution works for me.

    I push a repository to make some tests: https://github.com/cbou/extjs-nodejs-tree-panel-test

Thread Participants: 2

Tags for this Thread