Reputation: 196821
I am using the new header grouping feature of jqgrid 4.2 which works great except that it left aligns all of the text in the header groups.
How can align the header group text to be center in the cell?
Here is a screenshot to show you how it seems to be working by default: (I want "Books" to be center aligned")
NOTE: the regular column headers ARE center aligned.
Upvotes: 1
Views: 18245
Reputation: 1
this work
jQuery(grid_selector).jqGrid('setGroupHeaders', {
useColSpanStyle: false,//or true
groupHeaders: [
{ startColumnName: 'colName', numberOfColumns: 2, titleText: '<center>your text</center>' }
]
});
Upvotes: 0
Reputation: 1331
I had to center align text in table head columns in jqgrid, after element inspection, the following worked in my case:
.ui-jqgrid-sortable {
text-align: center;
}
Hope it helps someone.
Upvotes: 1
Reputation: 1021
Inspect the element then , get the id of the element
$('#jqgh_grid-table_CountryName').css('text-align', 'left');
Upvotes: 0
Reputation: 1
Try this,
$('.ui-jqgrid .ui-jqgrid-htable .ui-th-div').css('text-align', 'center');
Upvotes: 0
Reputation: 9
I had the same issue but i found the solution. you give titleText within the html center tag
titleText: ' open center tag Books close center tag'
Upvotes: 1
Reputation: 24125
The header group cell is given special class .ui-th-column-header. However this class has no special styling, if anywere in your project you have set text-align to left for th elements (for example in ASP.NET MVC the site.css is doing this) the text will not be center aligned. In most situations adding this to your CSS should do the trick:
.ui-th-column-header
{
text-align: center;
}
Upvotes: 8