« Return to Thread: error loading root children

Re: error loading root children

by David Worms :: Rate this Message:

Reply to Author | View in Thread


With the ItemFileReadStore, you can explorer this type of construct:

my_date: {"_type":"Date","_value":"2037-06-30"}

instead of

my_date: "2037-06-30"

I might be wrong, but it should work with objects as well as long as you
define the type handler (Date here) but it is currently not supported by
all store, ItemFileReadStore does.

Another alternative (not very cute), is to encode the object to json
such as it become a string and decode it when you retrieve the value
from the store.

d.


Jared Jurkiewicz a écrit :

> A nested object in an item is treated as another item.  See:
> http://docs.dojocampus.org/dojo/data/ItemFileReadStore#items-with-hierarchy.
>  In this case, you declare the identifier, then have an item that
> doesn't have an identifier.  The load of that structure will fail in
> the store.
>
> -- Jared
>
> On Sun, Oct 5, 2008 at 4:12 PM, Greg Ederer <greg@...> wrote:
>  
>> Hi,
>>
>> I use the JSON below to create an ItemFileReadStore, which I then use to
>> create a ForestStoreModel, which I use to create a Tree.  When I leave
>> out the 'months' property in the item with 'name' : 'RFE', it works
>> perfectly.  But, when 'months' refers to an {}, I get the following error:
>>
>>  [Widget dijit.Tree, dijit_Tree_0] _connects=HTMLDivElement
>> _deferredConnects=Object : error loading root children:  TypeError: _48
>> is undefined message=_48 is undefined
>>
>> I've tried using:
>>
>> {
>>    'name' : 'RFE',
>>    'type' : 'dataset',
>>    'periodicities' : [ 'daily', 'dekadal', 'monthly' ],
>>    'selectedPeriodicity' : 'monthly',
>>    'units' : [ 'raw', 'percent', 'zscore', 'mmdifference', 'spi' ],
>>    'selectedUnits' : 'raw',
>>    'months' : {}
>>  }
>>
>> as a test, and this doesn't work, either.  Is it permissible to have a
>> nested object in an item?
>>
>> Here's the complete JSON:
>>
>> {
>>  identifier : 'name',
>>  label : 'name',
>>  items : [
>>  {
>>    'name' : 'All Africa',
>>    'type' : 'region',
>>    'children': [
>>    {
>>      '_reference' : 'RFE'
>>    },
>>    {
>>      '_reference' : 'TPW'
>>    },
>>    {
>>      '_reference' : 'NDVI'
>>    },
>>    {
>>      '_reference' : 'WRSI'
>>    }
>>    ]
>>  },
>>  {
>>    'name' : 'East Africa',
>>    'type' : 'region',
>>    'children': [
>>    {
>>      '_reference' : 'RFE'
>>    },
>>    {
>>      '_reference' : 'TPW'
>>    },
>>    {
>>      '_reference' : 'NDVI'
>>    },
>>    {
>>      '_reference' : 'WRSI'
>>    }
>>    ]
>>  },
>>  {
>>    'name' : 'West Africa',
>>    'type' : 'region',
>>    'children': [
>>    {
>>      '_reference' : 'RFE'
>>    },
>>    {
>>      '_reference' : 'TPW'
>>    },
>>    {
>>      '_reference' : 'NDVI'
>>    },
>>    {
>>      '_reference' : 'WRSI'
>>    }
>>    ]
>>  },
>>  {
>>    'name' : 'South Africa',
>>    'type' : 'region',
>>    'children': [
>>    {
>>      '_reference' : 'RFE'
>>    },
>>    {
>>      '_reference' : 'TPW'
>>    },
>>    {
>>      '_reference' : 'NDVI'
>>    },
>>    {
>>      '_reference' : 'WRSI'
>>    }
>>    ]
>>  },
>>  {
>>    'name' : 'RFE',
>>    'type' : 'dataset',
>>    'periodicities' : [ 'daily', 'dekadal', 'monthly' ],
>>    'selectedPeriodicity' : 'monthly',
>>    'units' : [ 'raw', 'percent', 'zscore', 'mmdifference', 'spi' ],
>>    'selectedUnits' : 'raw',
>>    'months' : {
>>      '2003' : 'all',
>>      '2004' : 'all',
>>      '2005' : 'all',
>>      '2006' : 'all',
>>      '2007' : 'all',
>>      '2008' : [ '1', '2', '3', '4', '5', '6', '7' ]
>>    }
>>  },
>>  {
>>    'name' : 'TPW',
>>    'type' : 'dataset',
>>    'periodicities' : [ 'daily', 'dekadal' ],
>>    'selectedPeriodicity' : 'dekadal',
>>    'units' : [ 'raw', 'percent' ],
>>    'selectedUnits' : 'percent'
>>  },
>>  {
>>    'name' : 'NDVI',
>>    'type' : 'dataset',
>>    'periodicities' : [ 'daily', 'monthly' ],
>>    'selectedPeriodicity' : 'daily',
>>    'units' : [ 'raw', 'percent', 'spi' ],
>>    'selectedUnits' : 'spi'
>>  },
>>  {
>>    'name' : 'WRSI',
>>    'type' : 'dataset',
>>    'periodicities' : [ 'dekadal', 'monthly' ],
>>    'units' : [ 'raw', 'percent', 'zscore', 'spi' ],
>>    'selectedUnits' : 'zscore'
>>  }
>>  ]
>> }
>>
>> Any thoughts?
>>
>> Thanks!
>>
>> Greg
>>
>> --
>> | E R G O N O S I S
>> | Greg Ederer
>> | Lead Developer
>> | greg@...
>> | 360.774.6848
>> |
>>
>> _______________________________________________
>> FAQ: http://dojotoolkit.org/support/faq
>> Book: http://dojotoolkit.org/docs/book
>> Forums: http://dojotoolkit.org/forum
>> Dojo-interest@...
>> http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest
>>
>>    
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest@...
> http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest
>  


_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://dojotoolkit.org/docs/book
Forums: http://dojotoolkit.org/forum
Dojo-interest@...
http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest

 « Return to Thread: error loading root children