[fusion-commits] r2241 - sandbox/jxlib-3.0/lib

svn_fusion at osgeo.org svn_fusion at osgeo.org
Wed Sep 29 16:19:20 EDT 2010


Author: pagameba
Date: 2010-09-29 20:19:20 +0000 (Wed, 29 Sep 2010)
New Revision: 2241

Modified:
   sandbox/jxlib-3.0/lib/jxlib.uncompressed.js
Log:
updating jxlib 3 build.

Modified: sandbox/jxlib-3.0/lib/jxlib.uncompressed.js
===================================================================
--- sandbox/jxlib-3.0/lib/jxlib.uncompressed.js	2010-09-29 13:57:05 UTC (rev 2240)
+++ sandbox/jxlib-3.0/lib/jxlib.uncompressed.js	2010-09-29 20:19:20 UTC (rev 2241)
@@ -18617,15 +18617,17 @@
      *                  marked as deleted.
      */
     each: function (fn, bind, ignoreDeleted) {
-        var data;
-        if (ignoreDeleted) {
-            data = this.data.filter(function (record) {
-                return record.state !== Jx.Record.DELETE;
-            }, this);
-        } else {
-            data = this.data;
+        if ($defined(this.data)) {
+          var data;
+          if (ignoreDeleted) {
+              data = this.data.filter(function (record) {
+                  return record.state !== Jx.Record.DELETE;
+              }, this);
+          } else {
+              data = this.data;
+          }
+          data.each(fn, bind);
         }
-        data.each(fn, bind);
     },
     /**
      * APIMethod: get
@@ -31292,10 +31294,16 @@
      * APIMethod: getHeaderHTML
      */
     getHeaderHTML : function () {
-      if (this.isSortable()) {
-        new Element('img', {
+      if (this.isSortable() && !this.sortImage) {
+        this.sortImage = new Element('img', {
             src: Jx.aPixel.src
-        }).inject(this.domObj);
+        });
+        this.sortImage.inject(this.domObj);
+      } else {
+        if (!this.isSortable() && this.sortImage) {
+          this.sortImage.dispose();
+          this.sortImage = null;
+        }
       }
       return this.domObj;
     },
@@ -31631,6 +31639,9 @@
      * create the row template based on the current columns
      */
     buildTemplates: function() {
+      if (!this.grid) {
+        return;
+      }
       var rowTemplate = '',
           hasExpandable = false,
           grid = this.grid,
@@ -32533,6 +32544,16 @@
       'gridMouseLeave': false
     });
     
+    this.storeEvents = {
+      'storeDataLoaded': this.storeLoaded,
+      // 'storeSortFinished': this.drawStore,
+      'storeRecordAdded': this.addRow,
+      'storeColumnChanged': this.updateRow,
+      'storeRecordRemoved': this.removeRow,
+      'storeMultipleRecordsRemoved': this.removeRows
+    };
+    
+    
     this.parent();
   },
   
@@ -32625,12 +32646,7 @@
     });
     
     if (store instanceof Jx.Store) {
-      store.addEvent('storeDataLoaded', this.storeLoaded);
-      // store.addEvent('storeSortFinished', this.drawStore);
-      store.addEvent('storeRecordAdded', this.addRow);
-      store.addEvent('storeColumnChanged', this.updateRow);
-      store.addEvent('storeRecordRemoved', this.removeRow);
-      store.addEvent('storeMultipleRecordsRemoved', this.removeRows);
+      store.addEvents(this.storeEvents);
       if (store.loaded) {
         this.storeLoaded(store);
       }
@@ -32723,8 +32739,15 @@
    * store - {Object} the store to use for this grid
    */
   setStore: function(store) {
+    if (this.store) {
+      this.store.removeEvents(this.storeEvents);
+    }
     if (store instanceof Jx.Store) {
       this.store = store;
+      store.addEvents(this.storeEvents);
+      if (store.loaded) {
+        this.storeLoaded(store);
+      }
       this.render();
       this.domObj.resize();
     } else {
@@ -32754,6 +32777,8 @@
     
     this.gridObj.getElement('tbody').empty();
     
+    this.hoverColumn = this.hoverRow = this.hoverCell = null;
+    
     // TODO: consider moving whole thing into Jx.Columns ??
     // create a suitable column representation for everything
     // in the store that doesn't already have a representation
@@ -32814,8 +32839,8 @@
     }
     this.columns.calculateWidths();
     this.columns.createRules(this.styleSheet+'Columns', '.'+this.uniqueId);
+    this.drawStore();
     this.fireEvent('doneCreateGrid');
-    this.drawStore();
   },
   
   /**
@@ -33751,11 +33776,14 @@
         if (grid) {
             grid.gridTableBody.removeEvents({
               click: this.onCellClick
-            })
+            });
+            if (this.checkColumn) {
+                grid.columns.columns.erase(this.checkColumn);
+                this.checkColumn.destroy();
+                this.checkColumn = null;
+            }
         }
         if (options.useCheckColumn) {
-            col = grid.columns.getByName('selection');
-            grid.columns.columns.erase(col);
             if (options.checkAsHeader) {
                 grid.row.options.headerColumn = this.oldHeaderColumn;
             }
@@ -34798,7 +34826,7 @@
       var grid = this.grid,
           store = grid.store;
       this.removeHandles();
-      if (this.options.column) {
+      if (this.options.column && grid.columns.useHeaders()) {
         grid.columns.columns.each(function(col, idx) {
           if (col.isResizable() && !col.isHidden()) {
             var colEl = grid.colObj.getElement('.jxGridCol'+idx+ ' .jxGridCellContent');



More information about the fusion-commits mailing list