Skip to content

Commit

Permalink
Merge pull request #19469 from Tom-Finke/fix_child_table_in_dialog_so…
Browse files Browse the repository at this point in the history
…rtable

closes #19468
  • Loading branch information
shariquerik committed Jan 5, 2023
2 parents da6809e + 94669b1 commit efeed5c
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions frappe/public/js/frappe/form/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ export default class Grid {
this.toggle_checkboxes(this.display_status !== "Read");

// sortable
if (this.frm && this.is_sortable() && !this.sortable_setup_done) {
if (this.is_sortable() && !this.sortable_setup_done) {
this.make_sortable($rows);
this.sortable_setup_done = true;
}
Expand Down Expand Up @@ -553,17 +553,18 @@ export default class Grid {
let idx = $(event.item).closest(".grid-row").attr("data-idx") - 1;
let doc = this.data[idx % this.grid_pagination.page_length];
this.renumber_based_on_dom();
this.frm.script_manager.trigger(
this.df.fieldname + "_move",
this.df.options,
doc.name
);
this.frm &&
this.frm.script_manager.trigger(
this.df.fieldname + "_move",
this.df.options,
doc.name
);
this.refresh();
this.frm.dirty();
this.frm && this.frm.dirty();
},
});

$(this.frm.wrapper).trigger("grid-make-sortable", [this.frm]);
this.frm && $(this.frm.wrapper).trigger("grid-make-sortable", [this.frm]);
}

get_data(filter_field) {
Expand Down Expand Up @@ -825,11 +826,11 @@ export default class Grid {
let $item = $(item);
let index =
(this.grid_pagination.page_index - 1) * this.grid_pagination.page_length + i;
let d = locals[this.doctype][$item.attr("data-name")];
let d = this.grid_rows_by_docname[$item.attr("data-name")].doc;
d.idx = index + 1;
$item.attr("data-idx", d.idx);

this.frm.doc[this.df.fieldname][index] = d;
if (this.frm) this.frm.doc[this.df.fieldname][index] = d;
this.data[index] = d;
this.grid_rows[index] = this.grid_rows_by_docname[d.name];
});
Expand Down

0 comments on commit efeed5c

Please sign in to comment.