PDA

View Full Version : Centering a text to the middle in EXTJS GRID



vcheruk
16 Jul 2013, 9:28 PM
How do I center a text in an EXTJS Grid panel- I tried using the below that didnot help

.x-grid-cell.inner {
text-align: center; !important;
}

fily55
17 Jul 2013, 2:50 AM
How do I center a text in an EXTJS Grid panel- I tried using the below that didnot help

.x-grid-cell.inner {
text-align: center; !important;
}

Did you mean

.x-grid-cell-inner{
text-align: center; !important;
}

The above wroks.

Farish
17 Jul 2013, 2:56 AM
If you would only like it to work for a certain column in a grid, you can use the align (http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.grid.column.Column-cfg-align) config for gridcolumn:

align: 'center'

vcheruk
17 Jul 2013, 6:19 AM
How do I get to the middle/center of the block

align: 'center' places the text in the top center I need the data to be in the middle of the cell box ( because my cell height is a bit large. Is there a pack property

fily55
17 Jul 2013, 6:41 AM
How do I get to the middle/center of the block

align: 'center' places the text in the top center I need the data to be in the middle of the cell box ( because my cell height is a bit large. Is there a pack property

CSS property vertical-align should get you sorted for that.

Try:

.x-grid-cell-inner{
text-align: center; !important;
vertical-align : center;
}

Malteras
8 Oct 2015, 12:55 AM
This will probably help:

.#{$prefix}grid-td {
vertical-align: middle;
}