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

Roo/grid/Grid.js
roojs-all.js
roojs-debug.js
roojs-ui-debug.js
roojs-ui.js

index 18bd6eb..17d583a 100644 (file)
@@ -513,13 +513,13 @@ Roo.extend(Roo.grid.Grid, Roo.util.Observable, {
         this.cm.lookup[cfg.id] = cfg;
         if (typeof(pos) == 'undefined' || pos >= this.cm.config.length) {
             this.cm.config.push(cfg);
+            this.view.refresh(true);
             return;
         }
-        // slice
+        // splice
         pos = Math.max(0,pos);
-        
         this.cm.config.splice(pos, 0, cfg);
-        
+        this.view.refresh(true);
         
     }
     
index 64276ec..063193d 100644 (file)
@@ -2302,9 +2302,10 @@ if((!c.dom.offsetHeight||c.dom.offsetHeight<20)||c.getStyle("height")=="auto"){t
 if(Roo.isTouch){c.on("touchstart",this.onTouchStart,this);}this.relayEvents(c,["mousedown","mouseup","mouseover","mouseout","keypress"]);this.getSelectionModel().init(this);A.render();if(this.loadMask){this.loadMask=new Roo.LoadMask(this.container,Roo.apply({store:this.dataSource}
 ,this.loadMask));}if(this.toolbar&&this.toolbar.xtype){this.toolbar.container=this.getView().getHeaderPanel(true);this.toolbar=new Roo.Toolbar(this.toolbar);}if(this.footer&&this.footer.xtype){this.footer.dataSource=this.getDataSource();this.footer.container=this.getView().getFooterPanel(true);
 this.footer=Roo.factory(this.footer,Roo);}if(this.dropTarget&&this.dropTarget.xtype){delete this.dropTarget.xtype;this.dropTarget=new Roo.dd.DropTarget(this.getView().mainBody,this.dropTarget);}this.rendered=true;this.fireEvent('render',this);return this;
-},reconfigure:function(A,B){if(this.loadMask){this.loadMask.destroy();this.loadMask=new Roo.LoadMask(this.container,Roo.apply({store:A},this.loadMask));}this.view.bind(A,B);this.dataSource=A;this.colModel=B;this.view.refresh(true);},onKeyDown:function(e){this.fireEvent("keydown",e);
-},destroy:function(A,B){if(this.loadMask){this.loadMask.destroy();}var c=this.container;c.removeAllListeners();this.view.destroy();this.colModel.purgeListeners();if(!B){this.purgeListeners();}c.update("");if(A===true){c.remove();}},processEvent:function(A,e){if(A!='touchstart'){this.fireEvent(A,e);
-}var t=e.getTarget();var v=this.view;var B=v.findHeaderIndex(t);if(B!==false){var C=A=='touchstart'?'click':A;this.fireEvent("header"+C,this,B,e);}else{var D=v.findRowIndex(t);var E=v.findCellIndex(t);if(A=='touchstart'){A=false;if(typeof(this.selModel.getSelectedCell)!='undefined'){var cs=this.selModel.getSelectedCell();
+},reconfigure:function(A,B){if(this.loadMask){this.loadMask.destroy();this.loadMask=new Roo.LoadMask(this.container,Roo.apply({store:A},this.loadMask));}this.view.bind(A,B);this.dataSource=A;this.colModel=B;this.view.refresh(true);},addColumn:function(A,B){A.id=typeof(A.id)=='undefined'?Roo.id():A.id;
+this.cm.lookup[A.id]=A;if(typeof(B)=='undefined'||B>=this.cm.config.length){this.cm.config.push(A);this.view.refresh(true);return;}B=Math.max(0,B);this.cm.config.splice(B,0,A);this.view.refresh(true);}onKeyDown:function(e){this.fireEvent("keydown",e);},destroy:function(A,B){if(this.loadMask){this.loadMask.destroy();
+}var c=this.container;c.removeAllListeners();this.view.destroy();this.colModel.purgeListeners();if(!B){this.purgeListeners();}c.update("");if(A===true){c.remove();}},processEvent:function(A,e){if(A!='touchstart'){this.fireEvent(A,e);}var t=e.getTarget();var v=this.view;
+var B=v.findHeaderIndex(t);if(B!==false){var C=A=='touchstart'?'click':A;this.fireEvent("header"+C,this,B,e);}else{var D=v.findRowIndex(t);var E=v.findCellIndex(t);if(A=='touchstart'){A=false;if(typeof(this.selModel.getSelectedCell)!='undefined'){var cs=this.selModel.getSelectedCell();
 if(D==cs[0]&&E==cs[1]){A='dblclick';}}if(typeof(this.selModel.getSelections)!='undefined'){var cs=this.selModel.getSelections();var ds=this.dataSource;if(cs.length==1&&ds.getAt(D)==cs[0]){A='dblclick';}}if(!A){return;}}if(D!==false){this.fireEvent("row"+A,this,D,e);
 if(E!==false){this.fireEvent("cell"+A,this,D,E,e);}}}},onClick:function(e){this.processEvent("click",e);},onTouchStart:function(e){this.processEvent("touchstart",e);},onContextMenu:function(e,t){this.processEvent("contextmenu",e);},onDblClick:function(e){this.processEvent("dblclick",e);
 },walkCells:function(A,B,C,fn,D){var cm=this.colModel,E=cm.getColumnCount();var ds=this.dataSource,F=ds.getCount(),G=true;if(C<0){if(B<0){A--;G=false;}while(A>=0){if(!G){B=E-1;}G=false;while(B>=0){if(fn.call(D||this,A,B,cm)===true){return [A,B];}B--;}A--;
index a6304cf..05d9ef0 100644 (file)
@@ -55467,12 +55467,12 @@ Roo.extend(Roo.grid.Grid, Roo.util.Observable, {
         return this;
     },
 
-       /**
-        * Reconfigures the grid to use a different Store and Column Model.
-        * The View will be bound to the new objects and refreshed.
-        * @param {Roo.data.Store} dataSource The new {@link Roo.data.Store} object
-        * @param {Roo.grid.ColumnModel} The new {@link Roo.grid.ColumnModel} object
-        */
+    /**
+     * Reconfigures the grid to use a different Store and Column Model.
+     * The View will be bound to the new objects and refreshed.
+     * @param {Roo.data.Store} dataSource The new {@link Roo.data.Store} object
+     * @param {Roo.grid.ColumnModel} The new {@link Roo.grid.ColumnModel} object
+     */
     reconfigure : function(dataSource, colModel){
         if(this.loadMask){
             this.loadMask.destroy();
@@ -55484,7 +55484,32 @@ Roo.extend(Roo.grid.Grid, Roo.util.Observable, {
         this.colModel = colModel;
         this.view.refresh(true);
     },
-
+    /**
+     * addColumn
+     * Add's a column, default at the end..
+     * @param {Object} column configuration see {@link Roo.grid.ColumnModel} 
+     * @param {int} position to add (default end)
+     */
+    addColumn : function(cfg, pos)
+    {
+        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);
+            this.view.refresh(true);
+            return;
+        }
+        // slice
+        pos = Math.max(0,pos);
+        
+        this.cm.config.splice(pos, 0, cfg);
+        this.view.refresh(true);
+        
+    }
+    
+    
+    
+    
     // private
     onKeyDown : function(e){
         this.fireEvent("keydown", e);
index fdd5027..535682f 100644 (file)
@@ -32982,12 +32982,12 @@ Roo.extend(Roo.grid.Grid, Roo.util.Observable, {
         return this;
     },
 
-       /**
-        * Reconfigures the grid to use a different Store and Column Model.
-        * The View will be bound to the new objects and refreshed.
-        * @param {Roo.data.Store} dataSource The new {@link Roo.data.Store} object
-        * @param {Roo.grid.ColumnModel} The new {@link Roo.grid.ColumnModel} object
-        */
+    /**
+     * Reconfigures the grid to use a different Store and Column Model.
+     * The View will be bound to the new objects and refreshed.
+     * @param {Roo.data.Store} dataSource The new {@link Roo.data.Store} object
+     * @param {Roo.grid.ColumnModel} The new {@link Roo.grid.ColumnModel} object
+     */
     reconfigure : function(dataSource, colModel){
         if(this.loadMask){
             this.loadMask.destroy();
@@ -32999,7 +32999,32 @@ Roo.extend(Roo.grid.Grid, Roo.util.Observable, {
         this.colModel = colModel;
         this.view.refresh(true);
     },
-
+    /**
+     * addColumn
+     * Add's a column, default at the end..
+     * @param {Object} column configuration see {@link Roo.grid.ColumnModel} 
+     * @param {int} position to add (default end)
+     */
+    addColumn : function(cfg, pos)
+    {
+        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);
+            this.view.refresh(true);
+            return;
+        }
+        // slice
+        pos = Math.max(0,pos);
+        
+        this.cm.config.splice(pos, 0, cfg);
+        this.view.refresh(true);
+        
+    }
+    
+    
+    
+    
     // private
     onKeyDown : function(e){
         this.fireEvent("keydown", e);
index 6b936b4..44b6afe 100644 (file)
@@ -1432,9 +1432,10 @@ if((!c.dom.offsetHeight||c.dom.offsetHeight<20)||c.getStyle("height")=="auto"){t
 if(Roo.isTouch){c.on("touchstart",this.onTouchStart,this);}this.relayEvents(c,["mousedown","mouseup","mouseover","mouseout","keypress"]);this.getSelectionModel().init(this);A.render();if(this.loadMask){this.loadMask=new Roo.LoadMask(this.container,Roo.apply({store:this.dataSource}
 ,this.loadMask));}if(this.toolbar&&this.toolbar.xtype){this.toolbar.container=this.getView().getHeaderPanel(true);this.toolbar=new Roo.Toolbar(this.toolbar);}if(this.footer&&this.footer.xtype){this.footer.dataSource=this.getDataSource();this.footer.container=this.getView().getFooterPanel(true);
 this.footer=Roo.factory(this.footer,Roo);}if(this.dropTarget&&this.dropTarget.xtype){delete this.dropTarget.xtype;this.dropTarget=new Roo.dd.DropTarget(this.getView().mainBody,this.dropTarget);}this.rendered=true;this.fireEvent('render',this);return this;
-},reconfigure:function(A,B){if(this.loadMask){this.loadMask.destroy();this.loadMask=new Roo.LoadMask(this.container,Roo.apply({store:A},this.loadMask));}this.view.bind(A,B);this.dataSource=A;this.colModel=B;this.view.refresh(true);},onKeyDown:function(e){this.fireEvent("keydown",e);
-},destroy:function(A,B){if(this.loadMask){this.loadMask.destroy();}var c=this.container;c.removeAllListeners();this.view.destroy();this.colModel.purgeListeners();if(!B){this.purgeListeners();}c.update("");if(A===true){c.remove();}},processEvent:function(A,e){if(A!='touchstart'){this.fireEvent(A,e);
-}var t=e.getTarget();var v=this.view;var B=v.findHeaderIndex(t);if(B!==false){var C=A=='touchstart'?'click':A;this.fireEvent("header"+C,this,B,e);}else{var D=v.findRowIndex(t);var E=v.findCellIndex(t);if(A=='touchstart'){A=false;if(typeof(this.selModel.getSelectedCell)!='undefined'){var cs=this.selModel.getSelectedCell();
+},reconfigure:function(A,B){if(this.loadMask){this.loadMask.destroy();this.loadMask=new Roo.LoadMask(this.container,Roo.apply({store:A},this.loadMask));}this.view.bind(A,B);this.dataSource=A;this.colModel=B;this.view.refresh(true);},addColumn:function(A,B){A.id=typeof(A.id)=='undefined'?Roo.id():A.id;
+this.cm.lookup[A.id]=A;if(typeof(B)=='undefined'||B>=this.cm.config.length){this.cm.config.push(A);this.view.refresh(true);return;}B=Math.max(0,B);this.cm.config.splice(B,0,A);this.view.refresh(true);}onKeyDown:function(e){this.fireEvent("keydown",e);},destroy:function(A,B){if(this.loadMask){this.loadMask.destroy();
+}var c=this.container;c.removeAllListeners();this.view.destroy();this.colModel.purgeListeners();if(!B){this.purgeListeners();}c.update("");if(A===true){c.remove();}},processEvent:function(A,e){if(A!='touchstart'){this.fireEvent(A,e);}var t=e.getTarget();var v=this.view;
+var B=v.findHeaderIndex(t);if(B!==false){var C=A=='touchstart'?'click':A;this.fireEvent("header"+C,this,B,e);}else{var D=v.findRowIndex(t);var E=v.findCellIndex(t);if(A=='touchstart'){A=false;if(typeof(this.selModel.getSelectedCell)!='undefined'){var cs=this.selModel.getSelectedCell();
 if(D==cs[0]&&E==cs[1]){A='dblclick';}}if(typeof(this.selModel.getSelections)!='undefined'){var cs=this.selModel.getSelections();var ds=this.dataSource;if(cs.length==1&&ds.getAt(D)==cs[0]){A='dblclick';}}if(!A){return;}}if(D!==false){this.fireEvent("row"+A,this,D,e);
 if(E!==false){this.fireEvent("cell"+A,this,D,E,e);}}}},onClick:function(e){this.processEvent("click",e);},onTouchStart:function(e){this.processEvent("touchstart",e);},onContextMenu:function(e,t){this.processEvent("contextmenu",e);},onDblClick:function(e){this.processEvent("dblclick",e);
 },walkCells:function(A,B,C,fn,D){var cm=this.colModel,E=cm.getColumnCount();var ds=this.dataSource,F=ds.getCount(),G=true;if(C<0){if(B<0){A--;G=false;}while(A>=0){if(!G){B=E-1;}G=false;while(B>=0){if(fn.call(D||this,A,B,cm)===true){return [A,B];}B--;}A--;