Reputation: 1106
i need to align cell text to right side.
{
xtype : 'numbercolumn',
dataIndex : 'lineAmount',
id : 'lineAmount',
header : 'Net Line amount',
sortable : true,
width : 150,
summaryType : 'sum',
css: 'text-align: rigth;',
summaryRenderer : Ext.util.renderers.summary.sum,
editor : {
xtype : 'numberfield',
allowBlank : false
}
adding align property does not work for me because it also aligns header text
Upvotes: 7
Views: 20403
Reputation: 3932
As answered Mr_Green you can align the text to the right or left using align. For header to remain centrally aligned use css as :
.x-column-header-inner{
text-align:center;
}
Update :
.....//
{
xtype : 'grid',
cls : 'gridCss',
...//other configs
}
.....//
In your app.css file :
.gridCss .x-column-header-inner{
text-align:center;
}
In your index.jsp
<link rel="stylesheet" type="text/css" href="app/resources/css/app.css">
Upvotes: 4
Reputation: 1106
Actually thanks both guys for your posts it helped me alot. I have found one solution myself.
I needed to add id property to my column. For example :
{
xtype : 'numbercolumn',
dataIndex : 'lineAmount',
id : 'lineAmount',
header : 'Net Line amount',
}
and then it has its own css class for example : .x-grid3-td-lineAmount
so i added suggested css to these classes and it working ok now for me
.x-grid3-hd-inner{
text-align: left;
}
.x-grid3-hd-lineAmount{
text-align: left;
}
.x-grid3-td-lineAmount{
text-align: right;
}
.x-grid3-hd-taxAmount{
text-align: left;
}
.x-grid3-td-taxAmount{
text-align: right;
}
.x-grid3-hd-invoiceAmount{
text-align: left;
}
.x-grid3-td-invoiceAmount{
text-align: right;
}
i think in 4.2 version it is better to use @Mr_Green solution, but in 3.4 this workarround works for me :)
Upvotes: 0
Reputation: 41832
There is a config present for numbercolumn
known as align
. just use that.
Whenever you are stuck refer the secha docs which is beautifully designed just for beginners.
I am assuming you are beginner and explaining you how to use docs.. for your clear understanding:
align: "right"
code in the below "code editor".Updated
.columnAlign{
text-align: right;
}
tdCls: "columnAlign",
Upvotes: 6