How to add child table to the document in run time like the dilaog

we can in run time bulid dialog with fileds and tables in run time like that

 let d = new frappe.ui.Dialog({
                title: 'Enter details',
                fields: [
                    {
                        label: 'First Name',
                        fieldname: 'first_name',
                        fieldtype: 'Data'
                    }

as like the dialog i want to bulid grid table in the run time this table not connected to databse table with dynamic columns
how to achieve this

many thanks

any help please

Not sure I fully understand your question…

Maybe a look at “Make Purchase Order” in the Sales Order give some insights how it could be done?
erpnext/sales_order.js at develop · frappe/erpnext (github.com)

1 Like

many thanks moe
this like waht i need
but i want to use the table in page itself (doc) not in the dialog

i found soething like this

const table_fields = [

        {

            fieldname: "mode_of_payment", fieldtype: "Link",

            in_list_view: 1, label: "Mode of Payment",

            options: "Mode of Payment", reqd: 1

        }

frm.txx = frappe.ui.form.make_control({

        parent: $.find(".section-body"),

        df: {

            label: 'Due Date',

            "allow_bulk_edit": 1,

            fieldname: 'txx',

            fieldtype: 'Table',

            fields: table_fields

        },

        render_input: true

    })

    frm.doc.refresh();

and this code renderd the grid successfully
but many of features not working like copy and best for excel allow bulk data
what the correct way to bulid the grid table with out of loss the grid fuctionleties

thanks in advance