Fix sorting toolbar actions by group

This commit is contained in:
Hadi Nategh 2014-02-10 13:03:17 +00:00
parent 7cfdae66b6
commit 41ed0218d4

View File

@ -110,8 +110,8 @@ var et2_toolbar = et2_DOMWidget.extend(
last_group = $j('[data-group="' + action.group + '"]',this.actionlist); last_group = $j('[data-group="' + action.group + '"]',this.actionlist);
if(last_group.length == 0) if(last_group.length == 0)
{ {
$j('<span data-group="'+action.group+'">').appendTo(this.actionlist); $j('<span data-group="'+action.group+'">').appendTo(this.actionlist);
} }
last_group_id = action.group; last_group_id = action.group;
} }
@ -181,6 +181,10 @@ var et2_toolbar = et2_DOMWidget.extend(
} }
// ************** Drag and Drop feature for toolbar ***** // ************** 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.actionlist.appendTo(this.div);
this.actionbox.appendTo(this.div); this.actionbox.appendTo(this.div);