jQuery JQGrid-如何设置网格标题单元格的对齐方式? [英] Jquery JQGrid - How to set alignment of grid header cells?
问题描述
是否可以在jqgrid中对齐网格列标题?例如,左对齐右还是居中?
在jqrid文档中 http://www.trirand.com/jqgridwiki/doku.php?id = wiki:colmodel_options 它说:
align: Defines the alignment of the cell in the Body layer, not in header cell.
Possible values: left, center, right.
请注意,它说不在标题单元格中".如何为标题单元格(网格标题单元格)执行此操作?该文档没有提及这个小细节....
更改列标题对齐方式的最佳文献记录方法是使用jqGrid的 您还可以在CSS中定义一些类,并根据 通过选择函数'setLabel'的名称,是因为您无法定义jqGrid的 已更新:您可以使用类来定义 和 (我将5px定义为填充以更好地查看结果.您可以选择填充的值,这种情况下您会发现更好). Is it possible to align grid column headers in jqgrid? eg align left right or center? In the jqrid documents http://www.trirand.com/jqgridwiki/doku.php?id=wiki:colmodel_options it says: Note that it says "not in the header cell". How can I do this for the header cell (grid title cell)? The documentation fails to mention this little detail.... The best documented way to change column header alignment is the usage of You can change alignment of the column identified by With the code you can change the header name to 'Product Name' and set 'My ToolTip for the product name column header' as a tool tip for the corresponding column header. You can also define some classes in your CSS and set it for the column headers also with respect of By the way the name of the function 'setLabel' is choosed because you can not define UPDATED: You can do able to use classes to define and (I defined 5px as the padding to see results better. You can choose the padding value which you will find better in your case). 这篇关于jQuery JQGrid-如何设置网格标题单元格的对齐方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!setLabel
方法(请参见
setLabel
方法将其设置为列标题.colNames
参数,但可以使用colModel
中的其他'label'
选项来定义其他列标题作为'name'
值.'text-align'
或'padding'
.只需尝试.textalignright { text-align:right !important; }
.textalignleft { text-align:left !important; }
.textalignright div { padding-right: 5px; }
.textalignleft div { padding-left: 5px; }
grid.jqGrid ('setLabel', 'Name', '', 'textalignright');
grid.jqGrid ('setLabel', 'Description', '', 'textalignleft');
align: Defines the alignment of the cell in the Body layer, not in header cell.
Possible values: left, center, right.
setLabel
method of jqGrid (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods).'name': 'Name'
with the following code:grid.jqGrid ('setLabel', 'Name', '', {'text-align':'right'});
grid.jqGrid ('setLabel', 'Name', 'Product Name', {'text-align':'right'},
{'title':'My ToolTip for the product name column header'});
setLabel
method.colNames
parameter of the jqGrid, but use additional 'label'
option in the colModel
to define a column header other as the 'name'
value.'text-align'
or 'padding'
. Just try following.textalignright { text-align:right !important; }
.textalignleft { text-align:left !important; }
.textalignright div { padding-right: 5px; }
.textalignleft div { padding-left: 5px; }
grid.jqGrid ('setLabel', 'Name', '', 'textalignright');
grid.jqGrid ('setLabel', 'Description', '', 'textalignleft');