Author Topic: Can nested grid detail be inside master json data?  (Read 2712 times)

TeeJT

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 88
    • View Profile
Can nested grid detail be inside master json data?
« on: July 22, 2016, 08:12:27 am »
Can nested grid detail be inside master json data?

This means that the data is embedded in the json data e.g.

   "data":[ 
      { 
         "OrderID":10409,
         "ContactName":"Yvonne Moncada",
         "EmployeeID":3,
         "OrderDate":"01/09/1997",
         "RequiredDate":"02/06/1997",
         "ShippedDate":"01/14/1997",
         "ShipVia":"Speedy Express",
         "Freight":29.8300,
         "ShipName":"Océano Atlántico Ltda.",
         "ShipAddress":"Ing. Gustavo Moncada 8585 Piso 20-A",
         "ShipCity":"Buenos Aires",
         "ShipRegion":null,
         "ShipPostalCode":"1010",
         "ShipCountry":"Argentina",
         "paid":true,
         "OrderDetails":[ 
            { 
               "OrderID":10409,
               "ProductID":14,
               "ProductName":"Tofu",
               "UnitPrice":18.6000,
               "Quantity":12,
               "Discount":0
            },
            { 
               "OrderID":10409,
               "ProductID":21,
               "ProductName":"Sir Rodney\u0027s Scones",
               "UnitPrice":8.0000,
               "Quantity":12,
               "Discount":0
            }
         ]
      }
   ]
}

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6314
    • View Profile
Re: Can nested grid detail be inside master json data?
« Reply #1 on: July 22, 2016, 11:04:06 am »
Yes it works fine.

Inside the detailModel.init() callback. detail grid data can be accessed as:

var data = ui.rowData.OrderDetails;

//assign to detail grid before initialization of detail grid.
detailGridModel.dataModel.data = data;

TeeJT

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 88
    • View Profile
Re: Can nested grid detail be inside master json data?
« Reply #2 on: July 22, 2016, 11:27:10 am »
Thanks so much!
I got it done before reading your reply.

http://teejt.drivehq.com/testing/Visual/Paramquery/Samples/Nested1.html