Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1170
hierarchicalGrid binding with related JSON objects
posted
I want JSON binding to bind hierarchicalGrid. I’m getting data like below from Ajax Call. ProductId is the relation between them. My parents row need to be 
Product  and child row will be ProductDetails

var Product = [

{ProductId:1 , Name: "Food",  Company: "Food"},

{ProductId:2 , Name: "Food1",  Company: "Food1}]

 

var ProductDetails =[

{ProductId:1 , color: ”Red”  ,Quantity :”1”},

{ProductId:1 , color: ”Balack”  ,Quantity :”1”},

{ProductId:2 , color: ”Red”  ,Quantity :”1”}

{ProductId:2 , color: ”Balack”  ,Quantity :”1”}]

  

How I can bind this type of structure at client side using java script?

 

Thanks!

Manish

Parents
No Data
Reply
  • 37874
    posted

    Hello Manish,

    It is not possible to display the data in this format. You should reformat it in hierarchical JSON - the child records should be properties of the parent object. For example:

    { ProductId: 1, Name: "Food", Company: "Food1", Items: [

        {Color: "Red", Quantity: 1},

        {Color: "Black", Quantity: 5}

    ]}

    Please let me know if you have any further questions.

Children