Roo/grid/Grid.js
authorAlan Knowles <alan@roojs.com>
Thu, 7 May 2020 07:18:10 +0000 (15:18 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 7 May 2020 07:18:10 +0000 (15:18 +0800)
Roo/grid/Grid.js

index 14d4a7a..18bd6eb 100644 (file)
@@ -509,7 +509,16 @@ Roo.extend(Roo.grid.Grid, Roo.util.Observable, {
      */
     addColumn : function(cfg, pos)
     {
      */
     addColumn : function(cfg, pos)
     {
-        cfg.id = typeof(cfg.id) == 'undefined' : Roo.id() : cfg.id; // don't normally use this..
+        cfg.id = typeof(cfg.id) == 'undefined' ? Roo.id() : cfg.id; // don't normally use this..
+        this.cm.lookup[cfg.id] = cfg;
+        if (typeof(pos) == 'undefined' || pos >= this.cm.config.length) {
+            this.cm.config.push(cfg);
+            return;
+        }
+        // slice
+        pos = Math.max(0,pos);
+        
+        this.cm.config.splice(pos, 0, cfg);
         
         
     }
         
         
     }