Ext 4.2 Using proxy to save tree

前端 未结 1 802
谎友^
谎友^ 2021-01-27 19:11

when I use insertChild() or Sync(), proxy sends GET to server with just _dc param, what I should do to save my tree via proxy?

EDIT:added writer, now ext doing POST but

1条回答
  •  遥遥无期
    2021-01-27 19:51

    Configure a writer inside the proxy. Without the writer proxy does not know what to do.

    I have a tree in Ext 5.0 (but it works also in Ext 4.x) with tree model configured this way:

    Ext.define('At.model.ContinentModel',{
         extend:'Ext.data.TreeModel'
        ,alias:'model.continentmodel'
        ,idProperty:'id'
        ,fields:[
             {name:'text', type:'string', persist:true}
            ,{name:'iconColor', type:'string'}
        ]
        ,proxy:{
             type:'ajax'
            ,url:'resources/service.php/tree/read/1/'
            ,writer:{
                 type:'json'
                ,allowSingle:false
                ,encode:true
                ,rootProperty:'data'
            }
        }
    });
    

    The tree store is configured with autoSync:true. Changes in text field trigger server requests that look like this:

    Server request

    0 讨论(0)
提交回复
热议问题