[fusion-commits] r2308 - trunk/lib

svn_fusion at osgeo.org svn_fusion at osgeo.org
Fri Dec 17 15:57:07 EST 2010


Author: pagameba
Date: 2010-12-17 12:57:07 -0800 (Fri, 17 Dec 2010)
New Revision: 2308

Modified:
   trunk/lib/jxlib.uncompressed.js
Log:
fix a bug in jxlib sorting where selected rows become disconnected after a sort.

Modified: trunk/lib/jxlib.uncompressed.js
===================================================================
--- trunk/lib/jxlib.uncompressed.js	2010-12-17 16:41:19 UTC (rev 2307)
+++ trunk/lib/jxlib.uncompressed.js	2010-12-17 20:57:07 UTC (rev 2308)
@@ -33714,7 +33714,7 @@
     
     name: 'Selector',
 
-    Binds: ['select','checkSelection','checkAll','afterGridRender','onCellClick', 'sort', 'updateCheckColumn'],
+    Binds: ['select','checkSelection','checkAll','afterGridRender','onCellClick', 'sort', 'updateCheckColumn', 'updateSelectedRows'],
 
     options : {
         /**
@@ -33795,7 +33795,8 @@
             template;
         this.grid = grid;
         
-
+        this.grid.addEvent('gridSortFinished', this.updateSelectedRows);
+        
         //setup check column if needed
         if (options.useCheckColumn) {
           grid.addEvent('gridDrawRow', this.updateCheckColumn);
@@ -33925,6 +33926,8 @@
                 }
             }
         }
+        this.grid.removeEvent('gridSortFinished', this.updateSelectedRows);
+        
         this.grid = null;
     },
     /**
@@ -34037,6 +34040,20 @@
         }
     },
     
+    updateSelectedRows: function() {
+      if (!this.options.row) { return; }
+      var options = this.options,
+          r = this.grid.gridTableBody.rows,
+          rows = [];
+          
+      for (var i=0; i<r.length; i++) {
+        if (r[i].hasClass('jxGridRowSelected')) {
+          rows.push(i);
+        }
+      }
+      this.selected.set('rows', rows);
+    },
+    
     /**
      * Method: selectRow
      * Select a row and apply the jxGridRowSelected style to it.
@@ -34813,6 +34830,9 @@
         current.removeClass(opt.ascendingClass).removeClass(opt.descendingClass);
       }
       this.current = el;
+      
+      this.grid.fireEvent('gridSortStarting');
+      
       if ($defined(data.column.options.sort) && Jx.type(data.column.options.sort) == 'function') {
         data.column.options.sort(dir);
       } else {
@@ -34828,9 +34848,7 @@
             };
           });
     
-          // store.removeEvent('storeSortFinished', grid.drawStore);
           sorter.sort(data.column.name, null, dir);
-          // store.addEvent('storeSortFinished', grid.drawStore);
     
           store.each(function(record, index) {
             record.dom.cell.inject(gridTableBody);
@@ -34847,6 +34865,7 @@
           }
         }
       }
+      this.grid.fireEvent('gridSortFinished');
     }
   }
 });/*



More information about the fusion-commits mailing list