Hi, I’ve created a dialog box “insertDialog” with a table “Questions” inside it, having a field “qno”. I want to make it so that, whenever a new row is added, the qno gets autofilled with the idx of the new row, or idx of previous + 1. I’ve tried adding a default attribute to the field, and changing the get_data function. None of them worked out.
This is the simplified code I’ve written till now.
let insertDialog = new frappe.ui.Dialog({
title: 'Please enter the required details',
fields: [
{
label: `Questions`,
fieldname: `questions`,
fieldtype: 'Table',
data: data,
get_data: () => {
return data;
},
fields: [
{
label: `Q. No.`,
fieldname: 'qno',
fieldtype: 'Int',
in_list_view: 1,
}
]
}