Add Table fieldtype in prompt

I’m trying to add a Table fieldtype in frappe.prompt but I’m getting an error.

Below is the code and error log:


                                    'fieldname': 'checkbox',
                                    'fieldtype': 'Table',
                                    'label': 'checking testing',
                                    'reqd': 1,
                                    'options': 'Cancellation Reasons'

                            'Enter Reason',
form.min.js:3232 Uncaught TypeError: this.df.get_data is not a function
    at Class.get_data (form.min.js:3232)
    at Class.refresh (form.min.js:3041)
    at HTMLDivElement.<anonymous> (desk.min.js:6057)
    at HTMLDivElement.dispatch (jquery.min.js:3)
    at HTMLDivElement.$event.dispatch (report.min.js:3097)
    at HTMLDivElement.r.handle (jquery.min.js:3)
    at Object.trigger (jquery.min.js:4)
    at HTMLDivElement.<anonymous> (jquery.min.js:4)
    at Function.each (jquery.min.js:2)
    at n.fn.init.each (jquery.min.js:2)

you can not add table field type on the dialog/prompt. Add HTML field and render a table in it.

1 Like

how render a table… can you show any example ?

Refer this,

@Sangram ,
i’m new in erpnext…

let assement = new frappe.ui.Dialog({
			title: __("Assessment"),
			fields: [
					"fieldtype": "HTML",
					"label": __("Assessment"),
					"fieldname": "Assessment",
					"options":  result_table

var result_table = $(frappe.render_template('assessment_result_tool', {
		frm: frm,
		students: frm.doc.students,
		criteria: criteria_list,
		max_total_score: max_total_score

like this ??

Check following script, I have taken one HTML field on dialog and just rendered simple string on it. you can add new custom template/.html file to render. Check my previous reply for details.

 let dialog = new frappe.ui.Dialog({
    	title: __("Assessment"),
    	fields: [
    			"fieldtype": "HTML",
    			"label": __("Assessment"),
    			"fieldname": "assessment"
    dialog.set_primary_action(__("Commit"), () => {
    	// function/script to perform on primary action
    // here you can append your custom template in dialog HTML field
    dialog.fields_dict.assessment.$wrapper.html('<b>Render Template Here</b>');