PDA

View Full Version : how do you set the height of a row in a grid?



parmar
6 Mar 2008, 8:58 AM
I cant set the height of a row in a grid, my text gets hidden so i have to expand the columns to view rest of cell data

I deally i want the text to wrap in the cell so the cell height/row increases?

riets003
6 Mar 2008, 12:28 PM
I did it by using firbug to see the apllied css and then making the changes needed to the css

mabello
6 Mar 2008, 2:41 PM
You can also set the viewConfig of your grid like this:


viewConfig: {
forceFit:true,
enableRowBody:true,
showPreview:true,
getRowClass : function(record, rowIndex, p, store){
if(this.showPreview){
p.body = '<p style="color:red;">Write here write here Write here write here Write here write here Write here write here Write here write here </p>';
return 'x-grid3-row-expanded';
}
return 'x-grid3-row-collapsed';
}
}


With getRowClass function you can create a body for your row, but I'm not sure it is what you want, but get it a try :-)

parmar
7 Mar 2008, 1:22 AM
What i want to do is display the contents of my cell. So it wraps in the cell. At the moment i have to manually drag and extent my column. I want it to auto wrap into the fixed defined width of my column definition.

something like height of row is auto......can anyone help?

Animal
7 Mar 2008, 1:42 AM
Give the column you want to wrap an ID:

http://extjs.com/deploy/dev/docs/?class=Ext.grid.ColumnModel&member=id

Then define CSS classes like this:



td.x-grid3-td-<your id> {
overflow: hidden;
}
td.x-grid3-td-<your id> div.x-grid3-cell-inner {
white-space: normal;
}

mabello
7 Mar 2008, 1:56 AM
Thank you animal!!
Works great!

parmar
7 Mar 2008, 2:11 AM
animal,

this works but i need to apply this to every column, thirteen.

Each column has a id, thats 13 css definitions, is there a better way i can do this?

sorry my css is a bit weak?

Animal
7 Mar 2008, 2:42 AM
Just apply it to the basic td class in your grid then. You need to learn how to use CSS to do your job properly.

art187
9 Mar 2008, 8:11 AM
This doesn't seems to work for me. Is it the same in ext 2.0?

Animal
9 Mar 2008, 8:55 AM
Show us your code that doesn't work. Javascript and CSS. In code tags.