-
15 Feb 2007 7:02 AM #1
Populating Array Grid with one column hidden
Populating Array Grid with one column hidden
Hi,
I am using Array Grid and populating grid form an array. But I wanted to know
1. Can I Populate grid with columns id, name,salary using Array Grid so that in the grid id column remains hidden and is represents the row id of grid
with array
just like what we do in dase of ajax xml grid usingCode:var myData = [ [1,'John',5000], [2,'Petric',8000] ]
Can I use arrays in this case to populate grid.Code:var schema = { tagName: 'Item', id: 'ASIN', fields: ['Author', 'Title', 'Manufacturer', 'ProductGroup'] };
-
15 Feb 2007 8:52 AM #2
http://www.yui-ext.com/deploy/yui-ex...html#setHidden
At least I think this is what you're looking forCode:myDataModel = new YAHOO.ext.grid.DefaultDataModel([ [1,'john',5009], [2,'peter',8000]]); var cols = [ {header: "Id"}, {header: "Name"}, {header: "Salary"}]; myColModel = new YAHOO.ext.grid.DefaultColumnModel(cols); myColModel.setHidden(0); myGrid = new YAHOO.ext.grid.Grid('div-of-my-grid', myDataModel, myColModel);
-
15 Feb 2007 8:37 PM #3
Hi,
Thanks for replying.
I tried to use
to hide my column but it did not worked but when I triedCode:myColModel.setHidden(0);
It works fine where as in documentation we do not have any such methodCode:myColModel.setHidden(0,true);
docs say
ThanksCode:public function setHidden(Number colIndex) Sets if a column is hidden.
-
15 Feb 2007 9:01 PM #4
You can specify hidden in your columnModel
Code:{header:id, hidden:true}Tim Ryan
Read BEFORE posting a question / BEFORE posting a Bug
Use Google to Search - API / Forum
API Doc (4.x | 3.x | 2.x | 1.x) / FAQ / 1.x->2.x Migration Guide / 2.x->3.x Migration Guide
-
15 Feb 2007 11:43 PM #5
actually im using setHidden(0,true) myself, and it was used in my original reply in this thread. but i went back a couple of hours later and changed it to setHidden(0) because thats what it says in the docs (i didnt want to spread faulty code blabla)
this is from DefaultColumnModel.js:
once again we prove that code > docsCode:/** * Sets if a column is hidden. * @param {Number} colIndex The column index */ setHidden : function(colIndex, hidden){ this.config[colIndex].hidden = hidden; this.totalWidth = null; this.fireHiddenChange(colIndex, hidden); },
-
16 Feb 2007 8:15 AM #6
I would say that you were right to begin with. The docs are wrong. The correct usage is
setHidden(0, true) or setHidden(0, false) to hide or show the column. However, note that calling this method fires the hiddenchange event. You may or may not have this event hooked, but if you do, it may not be correct to fire it when you are initially building the columnModel.
If you're making a column hidden initially, e.g. when you're creating the CM, the way to do it is in the config with
This way you don't fire an event that may have unintended consequences.Code:{header:id, hidden:true}Tim Ryan
Read BEFORE posting a question / BEFORE posting a Bug
Use Google to Search - API / Forum
API Doc (4.x | 3.x | 2.x | 1.x) / FAQ / 1.x->2.x Migration Guide / 2.x->3.x Migration Guide
Similar Threads
-
Array-grid example, maximum column allow is 21?
By eric_sato in forum Ext 1.x: BugsReplies: 1Last Post: 28 Mar 2007, 8:19 PM -
Hidden Column Headers
By willpage in forum Ext 1.x: Help & DiscussionReplies: 2Last Post: 16 Jan 2007, 3:05 PM -
Problem with hidden column in grid
By manugoel2003 in forum Ext 1.x: BugsReplies: 7Last Post: 21 Dec 2006, 8:50 AM -
GridView focusRow() does not work if column 0 is hidden
By jarrod in forum Ext 1.x: BugsReplies: 2Last Post: 20 Dec 2006, 6:48 PM -
EditGrid hidden column
By anakreon in forum Ext 1.x: Help & DiscussionReplies: 2Last Post: 25 Oct 2006, 2:05 AM


Reply With Quote