I'm developing a custom extension for my client. There are two tables which hold the complete data.
primary_table
id_primary | name | age | image
===========|======|=====|===================
1 | Kush | 18 | a/c/aclong.jpg
2 | Lav | 19 | b/o/bottle.png
and
secondary_table
id_seconday | id_primary | item_name | quantity
============|============|===========|=========
1 | 1 | pen | 4
2 | 1 | pencil | 2
3 | 2 | eraser | 1
4 | 2 | sharpner | 1
5 | 2 | ruler | 2
I am able to show custom form to user and save the data. But while showing the data in the admin, I have a problem. As the normal Grid in the admin is simply a 2-D table, how can I display the details all at once?
One approach I think is to display the secondary_table
data as a table in one of the columns of the Grid. But how I can achieve that? How to make a table in a column of the grid? Or how to display this data simply?
Sample Display that I want.
Primary ID | Name | Age | Image | Secondary Data
===========|======|=====|=======|=======================================
| | | | Item Name | Quantity
1 | Kush | 18 | **** | -----------|---------
| | | | Pen | 4
| | | | Pencil | 2
-----------|------|-----|-------|---------------------------------------
| | | | Item Name | Quantity
2 | Lav | 19 | **** | -----------|----------
| | | | Eraser | 1
| | | | Sharpner | 1
| | | | Ruler | 2
I have a working code to display everything except the last Secondary Data
column. The code is same as the one created with moduleCreator
. Please help me with that last column. Thank you.