Hybrid View

  1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    20
    Vote Rating
    1
    oohogwash is on a distinguished road

      0  

    Default Unanswered: Modifying load function in Ext.data.TreeStore

    Unanswered: Modifying load function in Ext.data.TreeStore


    I have been loading TreeStore from a REST server, all works great if I construct the classes in the format the Tree requires on the Server.
    However I want the client to identify which nodes are leaf nodes by inspecting the JSON for children and setting the leaf property accordingly.
    I tried in onAppend listener but I think this is too late as the original JSON has already been bound to the model.

    I have a model as below...
    and load the Ext.data.TreeStore with this model assigned then apply this as a property in Ext.Tree.Panel.

    Where could I place a listener to intercept the loading of the model in the store from the JSON in the response? I have been looking for this but could not find it...Maybe I am looking in the wrong place or taking the wrong approach


    var e1tree = Ext.create('Ext.tree.Panel', {
    title: 'Namespace',
    width: 500,
    height: 300,
    expanded:true,
    collapsible: true,
    rootVisible: false,
    showLines:true,
    store: treeStore,
    hideHeaders:true,
    multiSelect: true,
    lines:true,
    columns: [{ var treeStore = Ext.create('Ext.data.TreeStore', {
    limitParam:1000,
    model: 'NamespaceModel',
    defaultRootId:'namespaces',
    nodeParam:'uid',
    proxy: {
    type: 'ajax',
    url: Ei.sys.Appdata.eiHost + 'mysite/test', //elements',
    root:'namespaces'
    },
    listeners: {
    append: function( thisNode, newChildNode, index, eOpts ) {



    Ext.define('NamespaceModel', {
    extend: 'Ext.data.Model',
    fields: [
    {name: 'uid', type: 'string'},
    {name: 'name', type: 'string'},
    {name:'uicls', type:'string'},
    {name:'leaf', type:'boolean'}
    ]
    });

  2. #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


    How do you determine the value of leaf field? Have you tried to define a convert() function?

  3. #3
    Sencha User
    Join Date
    May 2012
    Posts
    20
    Vote Rating
    1
    oohogwash is on a distinguished road

      0  

    Default hi

    hi


    no i have not , I will search on that... thanks

  4. #4
    Sencha User
    Join Date
    May 2012
    Posts
    20
    Vote Rating
    1
    oohogwash is on a distinguished road

      0  

    Default tried that

    tried that


    I found that convert does not have enough scope to do what I need.

    I implemented the code I want on the server (see below). It applies the properties I want on the fly. Whilst this works it is on the server not the client where it should be.
    I would like to intercept the JSON and apply this code or similar to it.
    That way different clients can adjust the recieved data to match the UI.
    Until then I have this on my server side... :-(

    var UpdateTree = function(tree){
    tree.forEach (function(x){
    if(x.children != undefined && x.children.length > 0)
    {
    x.leaf = false;
    x.expandable = true;
    UpdateTree(x.children);
    }
    else
    {
    x.leaf = true;
    x.expandable = false;
    }
    });
    };

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