1

I have a master store like:

var data = {

   identifier: "pkid",
   items: [ {pkid: 3456, name: "Tom", kids: [ {pkid: 3459, kidname: "Jenny"}, {pkid: 45698, kidname: "Jimmy"} ]
   }

   var mainStore = new ItemFileWriteStore({data: data});  

   var mainGrid = new var grid = new dojox.grid.DataGrid({
        id: 'grid',
        store: store,
        structure: layout,
        rowSelector: '20px'},
      document.createElement('div'));

    /*append the new grid to the div*/
    dojo.byId("maingridDiv").appendChild(grid.domNode);

    /*Call startup() to render the grid*/
    grid.startup();

   var selectedRow = mainGrid.getItem(0);

   var kids = mainStore.getValues(selectedRow, "kids");

var kidsData =

{

   identifier: "pkid",
   items: kids
   }

  var kidsStore = new ItemFileWriteStore({data: kidsData});

  var kidsGrid = ........
         store: kidsStore,
      ..............

First of all the reference kids in kidsData does not work as dojo throws error when rendering kidsGrid.

Secondly suppose I want to delete an item (row or kid) in kidsStore, I want that kid to be deleted from mainStore as well. Is there a good solution that works?

ace
  • 11,526
  • 39
  • 113
  • 193
  • **I can't to help you of all**, but let's see [In jsfiddle](http://jsfiddle.net/m6g9L/) some of your code not correct. May Be helped. – OammieR Feb 24 '12 at 07:57

1 Answers1

0

First, ItemFileWriteStore and JsonRestStore do not work with the same structures. IFWS uses arrays only whereas JRS uses a mix of arrays / objects.

I'm afraid you will have to manage the relationships by hand. For example, when clicking on validate after editing the kids, you will loop through them, then update the JRS, then JRS.save()

PEM
  • 1,948
  • 14
  • 13