ERPNext.com Frappe Cloud Documentation Partners Frappe School Public Chat

Show or hide columns child table

Hi everyone, I’m with a little issue with this, I need hide or show a column in a child table but some command doens’t work, I’ve already try:
“var df = frappe.meta.get_docfield(“Payment Entry Reference”,“reference_doctype”, cur_frm.doc.name);
cur_frm.fields_dict.references.grid.setup_visible_columns(“reference_doctype”, 0);”

“cur_frm.fields_dict.references.grid.toggle_enable(“reference_doctype”, false);”

“cur_frm.fields_dict.references.grid.set_column_disp(“reference_doctype”, false);”

And this is the same as the one above
“var grid = cur_frm.get_field(“references”).grid;
grid.set_column_disp(“reference_doctype”, 0);”

Thanks for advance.

is the way to go. Here is the result I get; the first column is effectively disabled:

In case that doesn’t work for you, post your code and screenshots.

Hi @pratu16x7 thanks for your answer this is the code
The commented part was the attempts.

=======///=======

party: function (frm) {

  •    setTimeout(function(){
    
  •        if(frm.doc.payment_type && frm.doc.party_type && frm.doc.party) {
    
  •   	if(!frm.doc.posting_date) {
    
  •   		frappe.msgprint(__("Please select Posting Date before selecting Party"))
    
  •   		frm.set_value("party", "");
    
  •   		return ;
    
  •   	}
    
  •   	frm.set_party_account_based_on_party = true;
    
  •   	return frappe.call({
    
  •   		method: "erpnext.accounts.doctype.payment_entry.payment_entry.get_party_details",
    
  •   		args: {
    
  •   			company: frm.doc.company,
    
  •   			party_type: frm.doc.party_type,
    
  •   			party: frm.doc.party,
    
  •   			date: frm.doc.posting_date
    
  •   		},
    
  •   		callback: function(r, rt) {
    
  •   			if(r.message) {
    
  •   				if(frm.doc.payment_type == "Receive") {
    
  •   					frm.set_value("paid_from", r.message.party_account);
    
  •   					frm.set_value("paid_from_account_currency", r.message.party_account_currency);
    
  •   					frm.set_value("paid_from_account_balance", r.message.account_balance);
    
  •   				} else if (frm.doc.payment_type == "Pay"){
    
  •   					frm.set_value("paid_to", r.message.party_account);
    
  •   					frm.set_value("paid_to_account_currency", r.message.party_account_currency);
    
  •   					frm.set_value("paid_to_account_balance", r.message.account_balance);
    
  •   				}
    
  •   				frm.set_value("party_balance", r.message.party_balance);
    
  •   				if (cur_frm.doc.payment_type == "Pay" && cur_frm.doc.party_type == "Supplier"){
    
  •                        setTimeout(function () {
    
  •                            var df = frappe.meta.get_docfield("Payment Entry Reference","reference_doctype", cur_frm.doc.name);
    
  •                            df.in_list_view = 0;
    
  •                            cur_frm.fields_dict.references.grid.setup_visible_columns("reference_doctype", 0);
    
  •                            cur_frm.fields_dict.references.grid.toggle_enable("reference_doctype", false);
    
  •                            cur_frm.fields_dict.references.grid.set_column_disp("reference_doctype", false);
    
  •                            //cur_frm.refresh();
    
  •                            //var grid = cur_frm.get_field("references").grid;
    
  •                            //grid.set_column_disp("reference_doctype", 0);
    
  •                            //refresh_field("references");
    
  •                            cur_frm.cscript.get_outstanding_documents(frm);
    
  •                        }, 100);
    
  •                    } else {
    
  •   				    frm.events.get_outstanding_documents(frm);
    
  •                        // var df = frappe.meta.get_docfield("Payment Entry Reference","reference_doctype", cur_frm.doc.name);
    
  •                        // console.log(df);
    
  •                        // df.in_list_view = 0;
    
  •                        // cur_frm.fields_dict.references.grid.setup_visible_columns("reference_name", 1);
    
  •                        // cur_frm.fields_dict.references.grid.toggle_enable("reference_name", true);
    
  •                        // cur_frm.fields_dict.references.grid.set_column_disp("reference_name", true);
    
  •                        // cur_frm.fields_dict["references"].grid.set_column_disp("reference_name", "hidden", false);
    
  •                        // cur_frm.refresh();
    
  •                        // var grid = cur_frm.get_field("references").grid;
    
  •                        // grid.set_column_disp("supplier_purchase_number", 0);
    
  •                    }
    

=======////

1 Like