« Return to Thread: error loading root children

Re: error loading root children

by Nick Vujasin :: Rate this Message:

Reply to Author | View in Thread

Jared Jurkiewicz <jared.jurkiewicz <at> gmail.com> writes:

>
> Yes, ItemFile*Store has the option of defining a custom data type as
> well, which will keep the store from treating nested objects of a
> specific form as a datastore item:
>
> http://docs.dojocampus.org/dojo/data/ItemFileReadStore#custom-types
>

Jared -

I'm trying to figure out how to get my 1.2 dojox.grid.DataGrid loaded with the
following store.  The ItemFileReadStore is erroring when trying to load the data
given below.  I am not using the 'files' attribute in the grid but when a row is
clicked on the grid I want to display the files that exist in the 'package' in
another pane.

My question is why does the store require you to provide the same identifier for
the children as the parent or force you to provide a custom type to convert a
simple object (i.e. my file object)?  I was hoping that the store, by default,
would be just that, a store that maintains exactly what was passed into it,
objects whose attributes are string values. If you needed to convert a field
into a specific type then at that point you can provide a conversion type to
convert the object.

If this is not the case, I am hoping you can show me how to convert the array of
file objects in a way the store will accept.

<span dojoType="dojo.data.ItemFileReadStore" jsId="jsonStore"
   data='{
      identifier:"package_name",
      label:"package_name",
      items:[{
         package_name:"Package1", product_name:"Product1",
         status:"Package Exported",
         files:[
            {file_name:"abc.mpg", file_size:"12MB"},
            {file_name:"cupcake.mpg", file_size:"8MB"}
         ]
      },{
         package_name:"Package2", product_name:"Product2",
         status:"BMS Package Deleted",
         files:[]
      }]}'></span>

Thanks
Nick


_______________________________________________
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