Details
-
New Feature
-
Resolution: Won't Fix
-
Neutral
-
None
-
4.4.4
-
None
-
-
Yes
-
Empty show more show less
Description
I have created move functions for the MgnlDynamicTable javascript lib.
The following functions can be added to /mgnl-resources/js-classes/mgnl/controls/DynamicTable.js
The functions have been tested on
- Safari 5.1.2 (Win7x64)
- FF 10 (Win7x64)
- Chrome 17.0.963.56 (Win7x64)
- IE 9 (Win7x64)
- IE 6 & 7 (WinXP, separate in a VM, not with multipleIE)
DynamicTable.js
/* ################################### ### Move an Object from one index to another. includes savety checks ################################### */ MgnlDynamicTable.prototype.move = function (from, to){ if(from == to || from == null || from == 'undefined' || to == null || to == 'undefined') { //do nothing } else if (from < to) { //move down var index = from; var objectToMove = this.objects[from]; var to = Math.min(to, this.objects.length-1); //safety... while(index < to) { var nextIndex = index+1; var nextObject = this.objects[nextIndex]; this.set(index, nextObject); index = nextIndex; } this.set(to, objectToMove); } else { //move up var index = from; var objectToMove = this.objects[from]; var to = Math.max(to, 0); //safety... while(index > to) { var nextIndex = index-1; var nextObject = this.objects[nextIndex]; this.set(index, nextObject); index = nextIndex; } this.set(to, objectToMove); } } /* ################################### ### Move an Object up ################################### */ MgnlDynamicTable.prototype.moveUp = function (index){ this.move(index, index-1); } /* ################################### ### Move an Object down ################################### */ MgnlDynamicTable.prototype.moveDown = function (index){ this.move(index, index+1); }
Checklists
Acceptance criteria