projects
/
roojs1
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f4700f0
)
Roo/grid/Grid.js
author
Alan Knowles
<alan@roojs.com>
Fri, 8 May 2020 08:15:26 +0000
(16:15 +0800)
committer
Alan Knowles
<alan@roojs.com>
Fri, 8 May 2020 08:15:26 +0000
(16:15 +0800)
Roo/grid/Grid.js
patch
|
blob
|
history
diff --git
a/Roo/grid/Grid.js
b/Roo/grid/Grid.js
index
17d583a
..
68ebec6
100644
(file)
--- a/
Roo/grid/Grid.js
+++ b/
Roo/grid/Grid.js
@@
-502,26
+502,38
@@
Roo.extend(Roo.grid.Grid, Roo.util.Observable, {
this.view.refresh(true);
},
/**
this.view.refresh(true);
},
/**
- * addColumn
+ * addColumn
s
* Add's a column, default at the end..
* Add's a column, default at the end..
- * @param {Object} column configuration see {@link Roo.grid.ColumnModel}
+
* @param {int} position to add (default end)
* @param {int} position to add (default end)
+ * @param {Array} of objects of column configuration see {@link Roo.grid.ColumnModel}
*/
*/
- addColumn
: function(cfg, pos
)
+ addColumn
s : function(pos, ar
)
{
{
- cfg.id = typeof(cfg.id) == 'undefined' ? Roo.id() : cfg.id; // don't normally use this..
- this.cm.lookup[cfg.id] = cfg;
+
+ 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) {
if (typeof(pos) == 'undefined' || pos >= this.cm.config.length) {
- this.cm.config.push(cfg);
- this.view.refresh(true);
- return;
+ 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.cm.config.splice(pos, 0, cfg);
}
}
- // splice
- pos = Math.max(0,pos);
- this.
cm.config.splice(pos, 0, cfg
);
+
+
+ this.
view.generateRules(this.cm
);
this.view.refresh(true);
this.view.refresh(true);
- }
+ }
,