3

I've jqgrid and Grid as Subgrid. I want to have different header style (say background color) for only subgrid.

I've tried to change .ui-jqgrid-htable,.ui-widget-header classes,but it's impacting both main grid and subgrid headers.

How can I only change subgrid header styles?

enter image description here

malkam
  • 2,337
  • 1
  • 14
  • 17
  • you write about "header style". Do you mean grid header (title, caption see the picture [here](http://www.trirand.com/jqgridwiki/doku.php?id=wiki:how_it_works)) or column headers? By the way you can create subgrid without the caption (grid title) at all. I personally prefer the way to save the place. – Oleg Jun 26 '14 at 06:51
  • Header layer(column header). I don't have caption for subgrid. – malkam Jun 26 '14 at 06:53

1 Answers1

3

You can set background CSS style on .ui-jqgrid .subgrid-data .ui-th-column for example to overwrite default background image and background color used in the column headers.

For example the following demo just remove the default background image and set yellow as the background color with respect of the following CSS

.ui-jqgrid .subgrid-data .ui-th-column { background: yellow }

The results look like on the picture below

enter image description here

UPDATED: One can consider to remove the column headers from subgrid at all. It could be interesting for example in case when the subgrid have only one column (one can use autowidth: true option in the subgrid additionally) or in case when subgrid have the same column headers like the main grid. See the answer for more information.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798