r1279 - branches/dev/grid/ui

r1279 - branches/dev/grid/ui


Author: paul.bakaus
Date: Mon Dec 29 10:34:55 2008
New Revision: 1279
Modified:
branches/dev/grid/ui/ui.grid.js
Log:
grid: column reordering step 2 done (missing is reordering in the backend)
Modified: branches/dev/grid/ui/ui.grid.js
==============================================================================
--- branches/dev/grid/ui/ui.grid.js    (original)
+++ branches/dev/grid/ui/ui.grid.js    Mon Dec 29 10:34:55 2008
@@ -17,7 +17,7 @@
            overflow: 'hidden'
        });
        
-        this.columnsContainer.gridSortable();
+        this.columnsContainer.gridSortable({ instance: this });
        
    },
@@ -469,10 +469,17 @@
    },
    
    _mouseStop: function(event) {
+        
+        var self = this;
        if(this.lastHovered) {
            $(this.lastHovered[0]).removeClass('ui-grid-column-sort-right
ui-grid-column-sort-left');
            $(this.lastHovered[0])[this.lastHovered[1]
== 'right' ? 'after' : 'before'](this.item);
+            
            //TODO: Reorder actual data columns
+            $('tr', this.options.instance.contentDiv).each(function(i) {
+                $('> td:eq('+self.items.index(self.lastHovered[0])+')',
this)[self.lastHovered[1] == 'right' ? 'after' : 'before']($('>
td:eq('+self.index+')', this));
+            });
+
        }
    }