[MAGNOLIA-3986] MgnlDynamicTable move functions Created: 01/Mar/12 Updated: 05/Jan/16 Resolved: 05/Jan/16 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | admininterface |
| Affects Version/s: | 4.4.4 |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Neutral |
| Reporter: | Stefan Baur | Assignee: | Philipp Bärfuss |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | 1m | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | 1m | ||
| Template: |
|
| Patch included: |
Yes
|
| Acceptance criteria: |
Empty
|
| Date of First Response: | |
| Visible to: |
Andrew Bernard, Daniel Kummer
|
| Description |
|
I have created move functions for the MgnlDynamicTable javascript lib. The functions have been tested on
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); } |
| Comments |
| Comment by Stefan Baur [ 18/Jan/13 ] |
|
Going through my reported tickets... I realize this is strategically non-important looking at magnolia 5 evolving. |
| Comment by Michael Mühlebach [ 05/Jan/16 ] |
|
I'm going to close this to set expectations so the issue doesn't stay open for years with no updates. If the issue is still relevant please feel free to reopen it or better create a new issue for 5.4. |