Frappe.ui.dialog with "table" field: Howto populate table from script?

Hi all,

I am trying to set up a dialog with a table like this:

           let dialog = new frappe.ui.Dialog({
				title: 'Table-Test',
				size: "extra-large",
				fields: [
						label: 'Table',
						fieldname: 'table',
						fieldtype: 'Table',
						cannot_add_rows: true,
						in_place_edit: false,
						data: [],
						fields: [
							{ fieldname: 'test', fieldtype: 'Data', in_list_view: 1, label: 'Test' }


So far, everything is fine. The table shows as expected an if I remove cannot_add_rows I can add rows.

However, I would like to populate the table via script prior to showing the table.

How would I do that?


1 Like

You’d pass the rows you want to add in the data property.


Do you know to make readonly or could not be editable

and how to add the button on the right side.
The idea is user click list of shipping charge to choose. I didn’t find any clue on documentation