javascriptdojodojox.grid.datagriddojox.griddojo.gridx

How can we set children in dojo TreeGrid?


when I use the LazyTreeGrid, I met a little problem; I have the file JSON like this:

{id: 'AF', name:'Africa',description:""},
{id: 'EG', name:'Egypt',description:""},
{id: 'KE', name:'Kenya',description:
 {
  compents: 
   [
    {id: 'Nairobi', name:'Nairobi', type:'city'},
    {id: 'Mombasa', name:'Mombasa', type:'city'}
   ]     
 }
}

I have no idea about how to set children in ForestStoreModel, maybe like childrenAttrs:['description.compents'] (unfortunately, it doesn't work...)?


Solution

  • I found one solution, we can use onComplete like this

    var model = new ForestStoreModel( {
        getChildren : function ( item, onComplete, onError ) {
            onComplete( item.dataDescription.components );
            }
    } );
    

    That works fine for me.