diff --git a/module/common/view/sortable.html.php b/module/common/view/sortable.html.php index 43ad4adc21..b71e44a02e 100644 --- a/module/common/view/sortable.html.php +++ b/module/common/view/sortable.html.php @@ -26,6 +26,12 @@ $(document).ready(function() trigger: $tbody.find('.sort-handler').length ? '.sort-handler' : null, finish: function(e) { + var orders = {}; + e.list.each(function(){ + var $this = $(this); + orders[$this.data('id')] = parseInt($this.attr('data-order')); + }); + e.orders = orders; $tbody.trigger('sort.sortable', e); var $thead = $tbody.closest('table').children('thead'); $thead.find('.headerSortDown, .headerSortUp').removeClass('headerSortDown headerSortUp').addClass('header'); diff --git a/module/product/view/index.html.php b/module/product/view/index.html.php index 1088f7b276..85ccae3b6c 100644 --- a/module/product/view/index.html.php +++ b/module/product/view/index.html.php @@ -55,7 +55,7 @@ - + diff --git a/module/project/view/index.html.php b/module/project/view/index.html.php index 1f0718e130..0613bec743 100644 --- a/module/project/view/index.html.php +++ b/module/project/view/index.html.php @@ -49,7 +49,7 @@ - + diff --git a/www/js/zui/zui.sortable.js b/www/js/zui/zui.sortable.js index 30feea9e61..6e2e8a5b5f 100644 --- a/www/js/zui/zui.sortable.js +++ b/www/js/zui/zui.sortable.js @@ -1,7 +1,7 @@ /* ======================================================================== - * ZUI: sortable.js + * ZUI: sortable (include droppable) * http://zui.sexy * ======================================================================== * Copyright (c) 2014 cnezsoft.com; Licensed MIT * ======================================================================== */ -!function(a,b,c){"use strict";var d=function(b,c){this.$=a(b),this.options=this.getOptions(c),this.init()};d.DEFAULTS={container:"body",deviation:5,sensorOffsetX:0,sensorOffsetY:0},d.prototype.getOptions=function(b){return b=a.extend({},d.DEFAULTS,this.$.data(),b)},d.prototype.callEvent=function(b,c){return a.zui.callEvent(this.options[b],c,this)},d.prototype.init=function(){this.handleMouseEvents()},d.prototype.handleMouseEvents=function(){var d=this.$,e=this,f=this.options,g="before";this.$triggerTarget=f.trigger?(a.isFunction(f.trigger)?f.trigger(d):d.find(f.trigger)).first():d,this.$triggerTarget.on("mousedown",function(h){function v(b){var h,i,q,v,w,x,g={left:b.pageX,top:b.pageY};c.abs(g.left-r.left)h&&g.top>i&&g.lefti?g.before(f):g.after(f),j=c.children(d.selector),e(j),a.zui.callEvent(d["order"],{list:j,element:f})}},finish:function(b){d.dragCssClass&&b.element&&b.element.removeClass(d.dragCssClass),a.zui.callEvent(d["finish"],{list:c.children(d.selector),element:b.element}),c.removeClass("sortable-sorting")}})},a.fn.sortable=function(b){return this.each(function(){var c=a(this),d=c.data("zui.sortable"),f="object"==typeof b&&b;d?"object"==typeof b&&d.reset():c.data("zui.sortable",d=new e(this,f)),"string"==typeof b&&d[b]()})},a.fn.sortable.Constructor=e}(jQuery,window,document,Math); +!function(a,b,c){"use strict";var d=function(b,c){this.$=a(b),this.options=this.getOptions(c),this.init()};d.DEFAULTS={container:"body",deviation:5,sensorOffsetX:0,sensorOffsetY:0},d.prototype.getOptions=function(b){return b=a.extend({},d.DEFAULTS,this.$.data(),b)},d.prototype.callEvent=function(b,c){return a.zui.callEvent(this.options[b],c,this)},d.prototype.init=function(){this.handleMouseEvents()},d.prototype.handleMouseEvents=function(){var d=this.$,e=this,f=this.options,g="before";this.$triggerTarget=f.trigger?(a.isFunction(f.trigger)?f.trigger(d):d.find(f.trigger)).first():d,this.$triggerTarget.on("mousedown",function(h){function v(b){var h,i,q,v,w,x,g={left:b.pageX,top:b.pageY};c.abs(g.left-r.left)h&&g.top>i&&g.lefti?g.before(f):g.after(f),j=c.children(d.selector).not(".drag-shadow"),e(j),a.zui.callEvent(d["order"],{list:j,element:f})}},finish:function(b){d.dragCssClass&&b.element&&b.element.removeClass(d.dragCssClass),a.zui.callEvent(d["finish"],{list:c.children(d.selector),element:b.element}),c.removeClass("sortable-sorting")}})},a.fn.sortable=function(b){return this.each(function(){var c=a(this),d=c.data("zui.sortable"),f="object"==typeof b&&b;d?"object"==typeof b&&d.reset():c.data("zui.sortable",d=new e(this,f)),"string"==typeof b&&d[b]()})},a.fn.sortable.Constructor=e}(jQuery,window,document,Math);