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);
}
],
"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",
}
],
"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",
}
],
"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",
</span><span class="jsdoc-keyword">return </span><span class="jsdoc-var">this</span><span class="jsdoc-syntax">;
},
- </span><span class="jsdoc-comment">/**
- * 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
- */
+ </span><span class="jsdoc-comment">/**
+ * 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
+ */
</span><span class="jsdoc-var">reconfigure </span><span class="jsdoc-syntax">: </span><span class="jsdoc-keyword">function</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">dataSource</span><span class="jsdoc-syntax">, </span><span class="jsdoc-var">colModel</span><span class="jsdoc-syntax">){
</span><span class="jsdoc-keyword">if</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">this.loadMask</span><span class="jsdoc-syntax">){
</span><span class="jsdoc-var">this.loadMask.destroy</span><span class="jsdoc-syntax">();
</span><span class="jsdoc-var">this.colModel </span><span class="jsdoc-syntax">= </span><span class="jsdoc-var">colModel</span><span class="jsdoc-syntax">;
</span><span class="jsdoc-var">this.view.refresh</span><span class="jsdoc-syntax">(</span><span class="jsdoc-keyword">true</span><span class="jsdoc-syntax">);
},
+ </span><span class="jsdoc-comment">/**
+ * 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}
+ */
+ </span><span class="jsdoc-var">addColumns </span><span class="jsdoc-syntax">: </span><span class="jsdoc-keyword">function</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">pos</span><span class="jsdoc-syntax">, </span><span class="jsdoc-var">ar</span><span class="jsdoc-syntax">)
+ {
+
+ </span><span class="jsdoc-keyword">for </span><span class="jsdoc-syntax">(</span><span class="jsdoc-keyword">var </span><span class="jsdoc-var">i </span><span class="jsdoc-syntax">=0;</span><span class="jsdoc-var">i</span><span class="jsdoc-syntax">< </span><span class="jsdoc-var">ar.length</span><span class="jsdoc-syntax">;</span><span class="jsdoc-var">i</span><span class="jsdoc-syntax">++) {
+ </span><span class="jsdoc-keyword">var </span><span class="jsdoc-var">cfg </span><span class="jsdoc-syntax">= </span><span class="jsdoc-var">ar</span><span class="jsdoc-syntax">[</span><span class="jsdoc-var">i</span><span class="jsdoc-syntax">];
+ </span><span class="jsdoc-var">cfg.id </span><span class="jsdoc-syntax">= </span><span class="jsdoc-keyword">typeof</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">cfg.id</span><span class="jsdoc-syntax">) == </span><span class="jsdoc-string">'undefined' </span><span class="jsdoc-syntax">? </span><span class="jsdoc-var">Roo.id</span><span class="jsdoc-syntax">() : </span><span class="jsdoc-var">cfg.id</span><span class="jsdoc-syntax">; </span><span class="jsdoc-comment">// don't normally use this..
+ </span><span class="jsdoc-var">this.cm.lookup</span><span class="jsdoc-syntax">[</span><span class="jsdoc-var">cfg.id</span><span class="jsdoc-syntax">] = </span><span class="jsdoc-var">cfg</span><span class="jsdoc-syntax">;
+ }
+
+
+ </span><span class="jsdoc-keyword">if </span><span class="jsdoc-syntax">(</span><span class="jsdoc-keyword">typeof</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">pos</span><span class="jsdoc-syntax">) == </span><span class="jsdoc-string">'undefined' </span><span class="jsdoc-syntax">|| </span><span class="jsdoc-var">pos </span><span class="jsdoc-syntax">>= </span><span class="jsdoc-var">this.cm.config.length</span><span class="jsdoc-syntax">) {
+ </span><span class="jsdoc-var">pos </span><span class="jsdoc-syntax">= </span><span class="jsdoc-var">this.cm.config.length</span><span class="jsdoc-syntax">; </span><span class="jsdoc-comment">//this.cm.config.push(cfg);
+ </span><span class="jsdoc-syntax">}
+ </span><span class="jsdoc-var">pos </span><span class="jsdoc-syntax">= </span><span class="jsdoc-var">Math.max</span><span class="jsdoc-syntax">(0,</span><span class="jsdoc-var">pos</span><span class="jsdoc-syntax">);
+ </span><span class="jsdoc-var">ar.shift</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">ar.length</span><span class="jsdoc-syntax">);
+ </span><span class="jsdoc-var">ar.shift</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">pos</span><span class="jsdoc-syntax">);
+ </span><span class="jsdoc-var">this.cm.config.splice.call</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">ar</span><span class="jsdoc-syntax">);
+
+
+
+ </span><span class="jsdoc-var">this.view.generateRules</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">this.cm</span><span class="jsdoc-syntax">);
+ </span><span class="jsdoc-var">this.view.refresh</span><span class="jsdoc-syntax">(</span><span class="jsdoc-keyword">true</span><span class="jsdoc-syntax">);
+
+ },
+
+
+
</span><span class="jsdoc-comment">// private
</span><span class="jsdoc-var">onKeyDown </span><span class="jsdoc-syntax">: </span><span class="jsdoc-keyword">function</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">e</span><span class="jsdoc-syntax">){
"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.",
"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.",
"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.",
,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<ar.length;i++){var B=ar[i];B.id=typeof(B.id)=='undefined'?Roo.id():B.id;this.cm.lookup[B.id]=B;}if(typeof(A)=='undefined'||A>=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<ar.length;i++){var B=ar[i];B.id=typeof(B.id)=='undefined'?Roo.id():B.id;this.cm.lookup[B.id]=B;}if(typeof(A)=='undefined'||A>=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();
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);
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);
,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<ar.length;i++){var B=ar[i];B.id=typeof(B.id)=='undefined'?Roo.id():B.id;this.cm.lookup[B.id]=B;}if(typeof(A)=='undefined'||A>=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<ar.length;i++){var B=ar[i];B.id=typeof(B.id)=='undefined'?Roo.id():B.id;this.cm.lookup[B.id]=B;}if(typeof(A)=='undefined'||A>=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();