Hi all!
I'm a bit confused about this issue.
I'have extended the dialog
** info.magnolia.cms.gui.dialog.DialogMultipleSelect **
with a "brand new"
** info.magnolia.cms.gui.dialog.DialogSortedMultipleSelect **
I've also extended the "core" javascript class "DynamicTable.js" with 2
methods, see below (-*-)
A strange thing appens: when I save my entries they are saved as
DataNode, I can see them in JCR browser.
But when I load them, with dialog or with paragraph, entries are
"randomly" sorted everytime!
time1
------------------------------------------------------
myItem1 [change..] [delete] [move up] [move down]
myItem2 [change..] [delete] [move up] [move down]
myItem3 [change..] [delete] [move up] [move down]
time2
------------------------------------------------------
myItem2 [change..] [delete] [move up] [move down]
myItem1 [change..] [delete] [move up] [move down]
myItem3 [change..] [delete] [move up] [move down]
time2
------------------------------------------------------
myItem1 [change..] [delete] [move up] [move down]
myItem3 [change..] [delete] [move up] [move down]
myItem2 [change..] [delete] [move up] [move down]
..and so on, without regularities.
I'm wondering how can it be possible to add a sort mechanism that
respect the table order when user save it.
Can you help me??
(-*-)
/* ###################################
### Move Up an Object
################################### */
MgnlDynamicTable.prototype.moveUp = function (index){
//convert to int
index = parseInt(index);
if (index == "NaN") return;
//reach the top?
if (index <= 0) return;
//allowed?
if (index > this.objects.length + 1) return;
//ready to switch
var obj1 = this.objects[index];
var obj2 = this.objects[index - 1];
this.objects[index - 1] = obj1;
this.objects[index] = obj2;
this.render();
}
/* ###################################
### Move Up an Object
################################### */
MgnlDynamicTable.prototype.moveDown = function (index){
//convert to int
index = parseInt(index);
if (index == "NaN") return;
//reach the bottom?
if (index >= this.objects.length - 1) return;
//allowed?
if (index < 0) return;
//ready to switch
var obj1 = this.objects[index];
var obj2 = this.objects[index + 1];
this.objects[index] = obj2;
this.objects[index + 1] = obj1;
this.render();
}
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------