frappe.ui.form.on(“Sales Order”, “onload”,function(frm,cdt, cdn)
{
$(".grid-add-row").hide();
});
frappe.ui.form.on(“Sales Order”, “onload”,function(frm,cdt, cdn)
{
$(".grid-add-row").hide();
});
i want to select data from time attendance device in this grid , and it is not logic to add row which is not in device
This will hide all of the add rows in the child tables in the document. That’s probably not good for a document with more than one child table, like your example in Sales Order.
cur_frm.set_df_property(“properties_list”, “read_only”, 1);
properties_list is your childtable field name… its working 100% please close this topic and mark as solution
what if to hide whole child table using one command only
Change it to hidden in Customize Form
tried but it doesn’t work, hidden not working for ‘table’ fieldtype
Use the following code to hide “Add row” and “Delete” in a particular child.
onload: function(frm) {
cur_frm.fields_dict[‘child_table_db_name’].grid.wrapper.find(‘.grid-add-row’).hide();
cur_frm.fields_dict[‘child_table_db_name’].grid.wrapper.find(‘.grid-remove-rows’).hide();
}
cur_frm.set_df_property(“properties_list”, “read_only”, 1); use this in the place of “properties_list” write your childtable name
hello this works for me
cur_frm.fields_dict[“(chiltable name)”].$wrapper.find(‘.btn.btn-xs.btn-default.grid-add-row’).addClass(“hidden”);
Hi all, similarly i need to hide Add Mulitple button below the child table…
frm.get_field(field_name).grid.cannot_add_rows = true;
need to refresh_field(field_name)
I got out using this code.If you want to hide add button completely,write code in refresh event.
refresh:function(frm)
{
frm.get_field(“items”).grid.cannot_add_rows = true;
}
-To hide that button depends on a condition add refresh code too.
frm.get_field(“items”).grid.cannot_add_rows = true;
refresh_field(“items”); //items=mychildTable
In js file:
frappe.ui.form.on(‘Doctype Name’, {
onload:function(frm){
//cannot able to add rows
frm.set_df_property(‘child_field_name’, ‘cannot_add_rows’, true);
//cannot able to delete rows
frm.set_df_property(‘child_field_name’, ‘cannot_delete_rows’, true);
}
});
js like this
onload: function(frm) {
frm.get_field('items').grid.cannot_add_rows = true;
}
Thanks man
Worked Well
Hello,
This code worked perfectly but i want to hide add row button after 7 rows and i want to set 50 word limit on each row.
can anyone help me,
Thank you.
frappe.ui.form.on('Listing Properties', {
onload: function(frm) {
frm.get_field('key_features').grid.cannot_add_rows = true;
}
});