I want to create a grid with subgrid and addrow button

I want to create a grid with subgrid and add row button for sub grid and parent grid . can you give a example

Hello.

Please, try to use the addRow() method to add a new record to your grid.
https://docs.dhtmlx.com/api__dhtmlxgrid_addrow.html
In case of the subgrid you need to get the subgrid object at first:
https://docs.dhtmlx.com/grid__sub-grid.html#gettingthesubgridobject
and then you can add e new record to it:

let subgrid=grid.cells(i,j).getSubGrid();
subgrid.addRow("new_id","col1,col2,col3")