PDA

View Full Version : Determine the height of a row in a grid?



tomhoag
29 Apr 2010, 12:44 PM
How can I get the height of a row in a grid?

My rows vary in height depending on how much wrapped text there is in one of the cells.

Thanks

tom

1 May 2010, 7:52 AM
Ext.Element gives you the ability to do a getHeight().

How exactly or when exactly do you plan on looking at the row?

tomhoag
3 May 2010, 5:20 AM
Thanks for the info.

I'd like to use the height of the row to size a TextArea editor appropriately.

I'm taking a look at the How and When right now.

Thoughts/Guidance are appreciated!

tom

3 May 2010, 5:24 AM
maybe hook into the beforeedit event for the grid?

tomhoag
3 May 2010, 7:35 AM
Yes, beforeedit looks to be the right place.

In the editEvent that is passed on the beforeedit event, I can see the row, column, record, etc. that are selected for edit. I'm trying to use the grid.get(id) call to get the Ext.Component of the row but not having any success. I'm supposing that the 'id' that I should be passing is not the row number or the record id, but the element id?

Perhaps I'm headed the wrong direction -- I don't see any element id's added to the <tr> or <td> elements of the grid . . .

Thanks again for the help

tom

tomhoag
3 May 2010, 8:03 AM
Here's what I came up with --


grid.on('beforeedit', function(editEvt) {
height = grid.view.getRow(editEvt.row).clientHeight;
textEditor.setHeight(height);
});

getRow() returns an HTMLElement so I wasn't able to use getHeight() -- am I missing something? Is accessing the clientHeight property of the HTMLElement the proper way to go about this?

tom