Accordion forEachItem


AFter enabling Multi_mode and and Drag and Drop, you can change the sequence (order) of the cells.

I would like the Accordion to have “updateSort” feature. This would cause the forEachItem to return the items based on their new sort order.

Example: If the accordion had three cells called A B C, and I moved The C cell to the topmost cell and then called “updateSort”
The forEachItem would return the cells in the order C A B



I wrote my own sort, incase someone else has a simular request.

            function getPanelOrder() {
                    var returnObj = [];
                    accordion_1.forEachItem( function(cell) {
                            cellName =cell.getText();
                            pattern = eval("/"+cellName+"/");
                            obj = document.getElementById('my_container').innerHTML.match(pattern)
                            returnObj.push( {'cellName': cellName, 'idx': obj.index} );

                    return returnObj.sort(function (a,b) {
                            var result = (a['idx'] < b['idx']) ? -1 : (a['idx'] > b['idx']) ? 1 : 0;
                            return result ;