Author: simoneg
Date: Mon Nov  8 17:14:16 2010
New Revision: 1032644

URL: http://svn.apache.org/viewvc?rev=1032644&view=rev
Log:
Keep right ordering of children intact on the client

Modified:
    
labs/magma/trunk/website-autoajax/src/main/resources/org/apache/magma/website/autoajax/autoajax.js

Modified: 
labs/magma/trunk/website-autoajax/src/main/resources/org/apache/magma/website/autoajax/autoajax.js
URL: 
http://svn.apache.org/viewvc/labs/magma/trunk/website-autoajax/src/main/resources/org/apache/magma/website/autoajax/autoajax.js?rev=1032644&r1=1032643&r2=1032644&view=diff
==============================================================================
--- 
labs/magma/trunk/website-autoajax/src/main/resources/org/apache/magma/website/autoajax/autoajax.js
 (original)
+++ 
labs/magma/trunk/website-autoajax/src/main/resources/org/apache/magma/website/autoajax/autoajax.js
 Mon Nov  8 17:14:16 2010
@@ -59,12 +59,16 @@ magma.autoajax = new function() {
         * other methods work correctly. 
         */
        this.updateState = function(statepart) {
+               var cnt=0;
                for (var id in statepart) {
-                       this.state.elements[id] = statepart[id];
+                       var grp = statepart[id];
                        var ele = document.getElementById(id);
                        if (ele) {
-                               this.state.elements[id].domElement=ele;
+                               grp.domElement=ele;
                        }
+                       grp.order = cnt;
+                       cnt++;
+                       this.state.elements[id] = grp;
                }
        }
        
@@ -130,6 +134,15 @@ magma.autoajax = new function() {
                                this.state.root.children.push(stategrp);
                        }
                }               
+               
+               for (var id in this.state.elements) {
+                       var stategrp = this.state.elements[id];
+                       if (stategrp.children && stategrp.children.length > 0) {
+                               stategrp.children.sort(function(a,b) {
+                                       return a.order - b.order;
+                               });
+                       }
+               }               
        }
        
        this.findStatesByUrl = function(url) {



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to