jqGrid:如何更改单元格填充 [英] jqGrid: how to change cell padding

查看:96
本文介绍了jqGrid:如何更改单元格填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在google托管的jQueryUI1.8.2和jQuery1.4.2上使用jqGrid3.6.5

I'm using jqGrid3.6.5 on google hosted jQueryUI1.8.2 and jQuery1.4.2

我想更改jqGrid的单元格填充。出于测试目的,我想在每个单元格周围将其设置为10px。

I want to change the cell padding of a jqGrid. For testing purposes I want to set it to 10px all around each cell.

我在google搜索时遇到的唯一选项如下:

The only option I've come across while googling is the following:


  1. 使用CSS添加填充。例如。 #grid-id td,#grid-id th {padding:10px; }

  2. 设置 cellLayout 选项21(paddingleft + paddingright + borderleft)

  1. add padding with CSS. eg. #grid-id td, #grid-id th { padding:10px; }
  2. set cellLayout option to 21 (paddingleft + paddingright + borderleft)

当我的colModel中的任何列都没有设置宽度时,这就像预期的那样工作。虽然当我调整其中一个标题或在colModel中设置列宽时,标题和单元格不再对齐。

When I have no set width on any of the columns in my colModel, this works like expected. Though when I resize one of the headers, or set a column width in the colModel, headers and cells aren't aligned anymore.

任何人都知道如何修复此问题或知道改变单元格填充的另一种方法是什么?

Anyone know how to fix this or know an alternative way to alter cell padding?

推荐答案

我找到了解决办法并且对于没有尽快找到它感到有点惭愧:P

I have found the solution and am a bit ashamed of not finding it sooner :P

显然网格标题是网格标题,但与网格本身不在同一个表格中。
所以通过将#grid-id th {...} 更改为 body .ui-jqgrid .ui-jqgrid-htable th { ...} 我按预期工作了。

Apparently the grid headers ARE th's but not in the same table as the grid itself. So by changing #grid-id th {...} to body .ui-jqgrid .ui-jqgrid-htable th {...} I got it to work as expected.

这篇关于jqGrid:如何更改单元格填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆