Merge pull request #12890 from rmehta/fix-grid-delete
fix(minor): Add a delete trigger in grid, and use it to refresh labels in Website Settings
This commit is contained in:
commit
85af21cd03
2 changed files with 14 additions and 10 deletions
|
|
@ -194,7 +194,10 @@ export default class Grid {
|
|||
}
|
||||
|
||||
tasks.push(() => {
|
||||
if (dirty) this.refresh();
|
||||
if (dirty) {
|
||||
this.refresh();
|
||||
this.frm.script_manager.trigger(this.df.fieldname + "_delete", this.doctype);
|
||||
}
|
||||
});
|
||||
|
||||
frappe.run_serially(tasks);
|
||||
|
|
@ -210,6 +213,7 @@ export default class Grid {
|
|||
this.frm.doc[this.df.fieldname] = [];
|
||||
$(this.parent).find('.rows').empty();
|
||||
this.grid_rows = [];
|
||||
this.frm.script_manager.trigger(this.df.fieldname + "_delete", this.doctype);
|
||||
|
||||
this.wrapper.find('.grid-heading-row .grid-row-check:checked:first').prop('checked', 0);
|
||||
this.refresh();
|
||||
|
|
|
|||
|
|
@ -33,20 +33,12 @@ frappe.ui.form.on('Website Settings', {
|
|||
frm.fields_dict.top_bar_items.grid.update_docfield_property(
|
||||
'parent_label', 'options', frm.events.get_parent_options(frm, "top_bar_items")
|
||||
);
|
||||
|
||||
if ($(frm.fields_dict.top_bar_items.grid.wrapper).find(".grid-row-open")) {
|
||||
frm.fields_dict.top_bar_items.grid.refresh();
|
||||
}
|
||||
},
|
||||
|
||||
set_parent_label_options_footer: function(frm) {
|
||||
frm.fields_dict.footer_items.grid.update_docfield_property(
|
||||
'parent_label', 'options', frm.events.get_parent_options(frm, "top_bar_items")
|
||||
'parent_label', 'options', frm.events.get_parent_options(frm, "footer_items")
|
||||
);
|
||||
|
||||
if ($(frm.fields_dict.footer_items.grid.wrapper).find(".grid-row-open")) {
|
||||
frm.fields_dict.footer_items.grid.refresh();
|
||||
}
|
||||
},
|
||||
|
||||
authorize_api_indexing_access: function(frm) {
|
||||
|
|
@ -122,10 +114,18 @@ frappe.ui.form.on('Website Settings', {
|
|||
});
|
||||
|
||||
frappe.ui.form.on('Top Bar Item', {
|
||||
top_bar_items_delete(frm) {
|
||||
frm.events.set_parent_label_options(frm);
|
||||
},
|
||||
|
||||
footer_items_add(frm, cdt, cdn) {
|
||||
frappe.model.set_value(cdt, cdn, 'right', 0);
|
||||
},
|
||||
|
||||
footer_items_delete(frm) {
|
||||
frm.events.set_parent_label_options_footer(frm);
|
||||
},
|
||||
|
||||
parent_label: function(frm, doctype, name) {
|
||||
frm.events.set_parent_options(frm, doctype, name);
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue