From 8673c23959602f121d1fb75c6a7ec7a656352897 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Fri, 8 May 2020 16:38:43 +0800 Subject: [PATCH] sync --- Roo/grid/Grid.js | 6 ++-- docs/json/roodata.json | 24 +++++++++++++ docs/src/Roo_grid_Grid.js.html | 46 +++++++++++++++++++++---- docs/symbols/Roo.grid.EditorGrid.json | 28 +++++++++++++++ docs/symbols/Roo.grid.Grid.json | 28 +++++++++++++++ docs/symbols/Roo.grid.PropertyGrid.json | 28 +++++++++++++++ roojs-all.js | 2 +- roojs-debug.js | 6 ++-- roojs-ui-debug.js | 6 ++-- roojs-ui.js | 2 +- 10 files changed, 159 insertions(+), 17 deletions(-) diff --git a/Roo/grid/Grid.js b/Roo/grid/Grid.js index 24da27ea12..473270564d 100644 --- a/Roo/grid/Grid.js +++ b/Roo/grid/Grid.js @@ -522,9 +522,9 @@ Roo.extend(Roo.grid.Grid, Roo.util.Observable, { pos = this.cm.config.length; //this.cm.config.push(cfg); } pos = Math.max(0,pos); - ar.shift(ar.length); - ar.shift(pos); - this.cm.config.splice.call(ar); + ar.unshift(0); + ar.unshift(pos); + this.cm.config.splice.apply(this.cm.config, ar); diff --git a/docs/json/roodata.json b/docs/json/roodata.json index bf8709b7e2..dffbb9014b 100644 --- a/docs/json/roodata.json +++ b/docs/json/roodata.json @@ -91781,6 +91781,14 @@ } ], "methods" : [ + { + "name" : "addColumns", + "type" : "function", + "desc" : "addColumns\nAdd's a column, default at the end..", + "sig" : "(position, of)", + "static" : false, + "memberOf" : "Roo.grid.Grid" + }, { "name" : "addEvents", "type" : "function", @@ -92306,6 +92314,14 @@ } ], "methods" : [ + { + "name" : "addColumns", + "type" : "function", + "desc" : "addColumns\nAdd's a column, default at the end..", + "sig" : "(position, of)", + "static" : false, + "memberOf" : "" + }, { "name" : "addEvents", "type" : "function", @@ -93500,6 +93516,14 @@ } ], "methods" : [ + { + "name" : "addColumns", + "type" : "function", + "desc" : "addColumns\nAdd's a column, default at the end..", + "sig" : "(position, of)", + "static" : false, + "memberOf" : "Roo.grid.Grid" + }, { "name" : "addEvents", "type" : "function", diff --git a/docs/src/Roo_grid_Grid.js.html b/docs/src/Roo_grid_Grid.js.html index 1bcdd67b46..351d32c22c 100644 --- a/docs/src/Roo_grid_Grid.js.html +++ b/docs/src/Roo_grid_Grid.js.html @@ -484,12 +484,12 @@ 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(); @@ -501,6 +501,40 @@ this.colModel = colModel; this.view.refresh(true); }, + /** + * addColumns + * Add's a column, default at the end.. + + * @param {int} position to add (default end) + * @param {Array} of objects of column configuration see {@link Roo.grid.ColumnModel} + */ + addColumns : function(pos, ar) + { + + for (var i =0;i< ar.length;i++) { + var cfg = ar[i]; + 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) { + pos = this.cm.config.length; //this.cm.config.push(cfg); + } + pos = Math.max(0,pos); + ar.shift(ar.length); + ar.shift(pos); + this.cm.config.splice.call(ar); + + + + this.view.generateRules(this.cm); + this.view.refresh(true); + + }, + + + // private onKeyDown : function(e){ diff --git a/docs/symbols/Roo.grid.EditorGrid.json b/docs/symbols/Roo.grid.EditorGrid.json index 712c26e7bd..fa77a3df84 100644 --- a/docs/symbols/Roo.grid.EditorGrid.json +++ b/docs/symbols/Roo.grid.EditorGrid.json @@ -466,6 +466,34 @@ "returns" : [ ] }, + { + "name" : "addColumns", + "desc" : "addColumns\nAdd's a column, default at the end..", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "memberOf" : "Roo.grid.Grid", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "position", + "type" : "int", + "desc" : "to add (default end)", + "isOptional" : false + }, + { + "name" : "of", + "type" : "Array", + "desc" : "objects of column configuration see {@link Roo.grid.ColumnModel}", + "isOptional" : false + } + ], + "returns" : [ + ] + }, { "name" : "render", "desc" : "Called once after all setup has been completed and the grid is ready to be rendered.", diff --git a/docs/symbols/Roo.grid.Grid.json b/docs/symbols/Roo.grid.Grid.json index fde6bb2870..ff77b6ac94 100644 --- a/docs/symbols/Roo.grid.Grid.json +++ b/docs/symbols/Roo.grid.Grid.json @@ -407,6 +407,34 @@ "returns" : [ ] }, + { + "name" : "addColumns", + "desc" : "addColumns\nAdd's a column, default at the end..", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "memberOf" : "Roo.grid.Grid", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "position", + "type" : "int", + "desc" : "to add (default end)", + "isOptional" : false + }, + { + "name" : "of", + "type" : "Array", + "desc" : "objects of column configuration see {@link Roo.grid.ColumnModel}", + "isOptional" : false + } + ], + "returns" : [ + ] + }, { "name" : "render", "desc" : "Called once after all setup has been completed and the grid is ready to be rendered.", diff --git a/docs/symbols/Roo.grid.PropertyGrid.json b/docs/symbols/Roo.grid.PropertyGrid.json index 77e130df85..42074f3524 100644 --- a/docs/symbols/Roo.grid.PropertyGrid.json +++ b/docs/symbols/Roo.grid.PropertyGrid.json @@ -520,6 +520,34 @@ "returns" : [ ] }, + { + "name" : "addColumns", + "desc" : "addColumns\nAdd's a column, default at the end..", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "memberOf" : "Roo.grid.Grid", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "position", + "type" : "int", + "desc" : "to add (default end)", + "isOptional" : false + }, + { + "name" : "of", + "type" : "Array", + "desc" : "objects of column configuration see {@link Roo.grid.ColumnModel}", + "isOptional" : false + } + ], + "returns" : [ + ] + }, { "name" : "render", "desc" : "Called once after all setup has been completed and the grid is ready to be rendered.", diff --git a/roojs-all.js b/roojs-all.js index e57c5ec434..2310b455f0 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -2303,7 +2303,7 @@ if(Roo.isTouch){c.on("touchstart",this.onTouchStart,this);}this.relayEvents(c,[" ,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);},addColumns:function(A,ar){for(var i=0; -i=this.cm.config.length){A=this.cm.config.length;}A=Math.max(0,A);ar.shift(ar.length);ar.shift(A);this.cm.config.splice.call(ar); +i=this.cm.config.length){A=this.cm.config.length;}A=Math.max(0,A);ar.unshift(0);ar.unshift(A);this.cm.config.splice.apply(this.cm.config,ar); this.view.generateRules(this.cm);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(); diff --git a/roojs-debug.js b/roojs-debug.js index c9443d3f40..1cda431fb3 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -55505,9 +55505,9 @@ Roo.extend(Roo.grid.Grid, Roo.util.Observable, { pos = this.cm.config.length; //this.cm.config.push(cfg); } pos = Math.max(0,pos); - ar.shift(ar.length); - ar.shift(pos); - this.cm.config.splice.call(ar); + ar.unshift(0); + ar.unshift(pos); + this.cm.config.splice.apply(this.cm.config, ar); diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index 2ef33c80ad..b4b532f2a5 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -33020,9 +33020,9 @@ Roo.extend(Roo.grid.Grid, Roo.util.Observable, { pos = this.cm.config.length; //this.cm.config.push(cfg); } pos = Math.max(0,pos); - ar.shift(ar.length); - ar.shift(pos); - this.cm.config.splice.call(ar); + ar.unshift(0); + ar.unshift(pos); + this.cm.config.splice.apply(this.cm.config, ar); diff --git a/roojs-ui.js b/roojs-ui.js index 2e16f0b629..3295299780 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -1433,7 +1433,7 @@ if(Roo.isTouch){c.on("touchstart",this.onTouchStart,this);}this.relayEvents(c,[" ,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);},addColumns:function(A,ar){for(var i=0; -i=this.cm.config.length){A=this.cm.config.length;}A=Math.max(0,A);ar.shift(ar.length);ar.shift(A);this.cm.config.splice.call(ar); +i=this.cm.config.length){A=this.cm.config.length;}A=Math.max(0,A);ar.unshift(0);ar.unshift(A);this.cm.config.splice.apply(this.cm.config,ar); this.view.generateRules(this.cm);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(); -- 2.39.2