Child table in custom Dialog type?

Any chance to add a child table in a custom Dialog type?

Add HTML field in dialog. Create html table and append to it.

And what about if need to submit values?

You can add a button and call a function @JoEz.

Am new to erp and would like you to shed more light on this. Below is my code base, one the the DocField is a table. How do i display it

else if($.inArray(“fsl employee”, frappe.user_roles) != -1 || $.inArray(“ms employee”, frappe.user_roles) != -1) {
frm.call({
method: “mmsapp.mmsapp.doctype.employee_profile_settings.employee_profile_settings.get_employee_setting_count”,
}).then(r => {
console.log('value returned: '+r.message);
result = r.message;
edit_profile(result);
});
console.log('result is: '+result)
}
function edit_profile(result){
console.log('result is: '+result)
if(result){
return frm.add_custom_button(‘Edit Profile’, () => {
frm.call({
method: “mmsapp.mmsapp.doctype.employee_profile_settings.employee_profile_settings.get_employee_settings”,
}).then(r => {
console.log('value returned: '+r.message.permanent_staff.length);
if (r.message.permanent_staff) {
var fields_arr = [];
console.log(r.message);
r.message.permanent_staff.forEach(function (value){
if(value.can_edit == 1){
var field_j = {};
var concat_frm_field = ‘frm.doc.’+value.ps_field_name;
console.log('concat_frm_field: '+ concat_frm_field);
field_j.label = value.ps_label;
console.log('ps_label: '+ value.ps_label);
field_j.fieldname = value.ps_field_name;
field_j.fieldtype = value.ps_field_type;
field_j.reqd = parseInt(value.ps_req);
if(field_j.fieldtype == ‘Select’){
field_j.options = cur_frm.fields_dict[value.ps_field_name].df.options.split("\n");
field_j.default = eval(concat_frm_field);
}else if(field_j.fieldtype == ‘Link’){
field_j.options = cur_frm.fields_dict[value.ps_field_name].df.options;
field_j.default = eval(concat_frm_field);
}//Garuba Update start
else if(field_j.fieldtype == ‘Table’){
console.log('field_j is: — '+ JSON.stringify(field_j));
field_j.options = cur_frm.fields_dict[value.ps_field_name].df.options;
console.log('field_j is: — '+ JSON.stringify(field_j));
}//Garuba Update End
else{
field_j.default = eval(concat_frm_field);
}
console.log('field_j is: '+ JSON.stringify(field_j));
if(field_j.fieldtype != ‘Table’){
fields_arr.push(field_j);
}else{
console.log(‘Type Table Selected!!!’)
}
}
});
console.log('fields_arr scope is: '+ fields_arr.length);
var d = new frappe.ui.Dialog({

                                'fields':fields_arr,
                                primary_action_label: 'Submit',
                                primary_action(values) {
                                    console.log(values);
                                    frm.call({
                                        method: "mmsapp.mmsapp.doctype.employee_profile_settings.employee_profile_settings.update_employee_record",
                                        args:{
                                            emp: values,
                                            doc_name: cur_frm.doc.name,
                                        },
                                        callback: function (data) {
                                            console.log(data.message);
                                            if(data.message)
                                                frm.reload_doc();
                                            d.hide();
                                            frappe.msgprint({
                                                title: __('Notification'),
                                                indicator: 'green',
                                                message: __('Your updates has been sent to the HR Manager for approval')
                                            });
                                        }
                                    });
                                }
                            });
                            d.show();

POS uses child table in a dialog

2 Likes