PDA

View Full Version : How to get the reference of a grid?



saasira
26 Dec 2006, 2:20 AM
Hi!
I' want to get the data from the grid .
first I'm trying it by using the following code.


var element = YAHOO.ext.Element.get('example-grid');
alert(element.getRow(0));


where 'example-grid' is the grid container div .
But I'm I'm getting undefined .
Is there any other way to get the refence to the grid ,and get the data back?


Thanking you in advance for your answering my questions patiently,
Samba

jack.slocum
26 Dec 2006, 3:53 AM
You will need to keep a reference to the grid. There is no way to get the object from the DOM node.

saasira
26 Dec 2006, 5:12 AM
Hi! Jack,
I've kept the grid variable global as you have suggested.

And I'm trying to retrieve the data.
But I couldn't find a method that compliments the setter method


grid.getCellValue("Rama Rao",0,0);


or a more generel method like


grid.getRow(0).getCell(0).getValue();


Am I looking for the wrong methods?
Is this behaviour put in different way into the grid?

If so please clarify,
Thanking you for your co-operation,
Samba

jack.slocum
26 Dec 2006, 5:37 AM
Take a look at the docs. All the methods and arguments are documented. For accessing data, you will want to use your data model.

grid.getDataModel() will give you the data model. The available functions on the data model are documented.

http://www.yui-ext.com/docs/

davcha
14 Apr 2007, 2:08 PM
How do you get the data contained in a specific cell of a data store in ext 1.0 ?

Animal
15 Apr 2007, 1:51 AM
Get the Record for the row from the Store using http://www.extjs.com/deploy/ext/docs/output/Ext.data.Store.html#getAt

The Record has a method



get(fieldName);


The documentation in SVN has this. Documentation is being worked on very heavily by Jack and Brian and will be available soon.

davcha
15 Apr 2007, 2:07 AM
There's no possibility to get the cell using row and column indexes ?

Why using rowindex and colindex in various grid events, then (cellclick, celldblclick, etc..) ?

Animal
15 Apr 2007, 2:34 AM
Because columns can be moved.

You'd use



myColumnModel.getDataIndex(colIndex);


to get the name of the field at that column.

davcha
15 Apr 2007, 2:46 AM
Ok, i see. Thanks :)