From f060cecbf9e83f0269766fb468f1b62c99de9e3d Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Sun, 23 Oct 2016 17:17:16 +0530 Subject: [PATCH] [fix] sortable now needs group --- .../print_format_builder/print_format_builder.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/frappe/print/page/print_format_builder/print_format_builder.js b/frappe/print/page/print_format_builder/print_format_builder.js index b74b335d7a..0574dfa184 100644 --- a/frappe/print/page/print_format_builder/print_format_builder.js +++ b/frappe/print/page/print_format_builder/print_format_builder.js @@ -304,7 +304,9 @@ frappe.PrintFormatBuilder = Class.extend({ // drag from fields library Sortable.create(this.page.sidebar.find(".print-format-builder-fields").get(0), { - group: {put: true, pull:"clone"}, + group: { + name:'field', put: true, pull:"clone" + }, sort: false, onAdd: function(evt) { // on drop, trash! @@ -326,11 +328,13 @@ frappe.PrintFormatBuilder = Class.extend({ var me = this; Sortable.create(col, { group: { + name: 'field', put: true, pull: true }, onAdd: function(evt) { // on drop, change the HTML + var $item = $(evt.item); if(!$item.hasClass("print-format-builder-field")) { var fieldname = $item.attr("data-fieldname"); @@ -342,8 +346,10 @@ frappe.PrintFormatBuilder = Class.extend({ fieldname); } - $item.replaceWith(frappe.render_template("print_format_builder_field", - {field: field, me:me})) + var html = frappe.render_template("print_format_builder_field", + {field: field, me:me}); + + $item.replaceWith(html); } } });