Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extjs allign only cell text to right

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

like image 402
kuldarim Avatar asked Sep 26 '13 09:09

kuldarim


2 Answers

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:

  • First go to search field, to search for a component, method, or event or something else.

enter image description here


  • In your case, let us assume that you have searched for "numbercolumn", then you can see the following window which displays all the cofigs, properties, methods etc.. Just hover on them and know what "numbercolumn" is related with.
  • In your case, you are looking for a config which align's the text to right. then you are mostly looking for key words like txtAlign, align, textAlign, etc..
  • Hence, you will find a config, which is by name "align". just click on it to learn more about it.

enter image description here


  • After learning about the cofig "align", you might want to test it. For this purpose, the docs have provided inline code editor which is shown in the below image.
  • The code editor has two tabs, "code editor" and "live preview". The words says everything.
  • Just add your changes in "code editor" tab and see your result in "live preview" tab.

enter image description here


  • For example, Adding align: "right" code in the below "code editor".

enter image description here


Updated

CSS:

.columnAlign{
     text-align: right;
}

extjs

tdCls: "columnAlign",
like image 86
Mr_Green Avatar answered Nov 09 '22 02:11

Mr_Green


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">
like image 4
Dev Avatar answered Nov 09 '22 02:11

Dev