Author Topic: Center align not working for column header  (Read 3774 times)

EPM Solutions

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 182
    • View Profile
Center align not working for column header
« on: October 13, 2017, 04:13:48 pm »
Hello Team,

i tried to center header text but it is not working.
i want header text in center and all the other data in right aligned.

please check my code below.
i create columns in loop.


  for (i = 1; i <= 7; i++) {
            ObjFund.colModel.push({
              title: startYear + i,
              dataType: 'float',
              width: 90,
              halign: "center",
              align: "right",
              dataIndx: 'Year_x0020_Amt' + i,
              format: '$##,###',
              summary: {
                type: "all", //use custom aggregate.
                edit: false
              },
              validations: [{
                type: 'gte',
                value: 0,
                msg: "should be >= 0"
              }],
              render: function(ui) {
                return {
                  style: 'text-align:right'
                };
              }
            });
          }

and also please find below attached screen shot.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Center align not working for column header
« Reply #1 on: October 16, 2017, 09:59:02 am »
align for body cells & halign for header cell works fine in the grid.

http://jsfiddle.net/gqjzfez1/1/

Please check whether you have overridden the properties somewhere else in your code.

or css rules that override the cell alignment.

EPM Solutions

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 182
    • View Profile
Re: Center align not working for column header
« Reply #2 on: October 16, 2017, 11:02:24 am »
Hello Team,

Thanks for your response but still same result.
 checked every where no overridden properties  in code.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Center align not working for column header
« Reply #3 on: October 16, 2017, 11:14:00 am »
Which version of grid you have been using?

Please share a jsfiddle.