Thanks Dimitar for your help.
I worked way out by giving incremental id to the detail grid, the example assigned ‘detailgrid’ as id to all row’s child grids which stored only the last grid against the id. I put index in suffix so I could then read all the grids with their unique ids.