From 41ed0218d446e7afffa0258c1a8974348dd84ca7 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Mon, 10 Feb 2014 13:03:17 +0000 Subject: [PATCH] Fix sorting toolbar actions by group --- etemplate/js/et2_widget_toolbar.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/etemplate/js/et2_widget_toolbar.js b/etemplate/js/et2_widget_toolbar.js index 55ff1c8cdf..ff09c189a0 100644 --- a/etemplate/js/et2_widget_toolbar.js +++ b/etemplate/js/et2_widget_toolbar.js @@ -110,8 +110,8 @@ var et2_toolbar = et2_DOMWidget.extend( last_group = $j('[data-group="' + action.group + '"]',this.actionlist); if(last_group.length == 0) { - $j('').appendTo(this.actionlist); - } + $j('').appendTo(this.actionlist); + } last_group_id = action.group; } @@ -181,6 +181,10 @@ var et2_toolbar = et2_DOMWidget.extend( } // ************** Drag and Drop feature for toolbar ***** + this.actionlist.find('span').sort( function (lg,g){ + return +lg.dataset.group - +g.dataset.group; + }).appendTo(this.actionlist); + this.actionlist.appendTo(this.div); this.actionbox.appendTo(this.div);