如何添加两个不同的风格的jqgrid [英] how to add two differents style's jqgrid

查看:91
本文介绍了如何添加两个不同的风格的jqgrid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这里有我的页面和两个网格...第一个网格具有此列标题的样式

have my page and two grid here...the first grid have this style for the column header

<style type="text/css">
 .ui-jqgrid table.ui-jqgrid-htable {
     height:60px;
 }
 </style>

这在表1中,在表2中有我的其他网格,但是没有样式

This is in table1, and in table2 have my other grid but without style

加载页面时,第二个网格获取第一个网格的样式,列标题大小为60

when load the page, the second grid get the style for the first grid and the column header size is 60

出什么问题了?

pd:对不起,我的英语

pd: sorry for my english

推荐答案

您使用的CSS样式适用于两个网格,因为您在CSS规则中使用了 classes ui-jqgridui-jqgrid-htable .具有类的元素在两个网格中都存在.如果只想在一个网格上应用某些CSS设置,则可以使用例如ID.例如,如果使用的两个网格的ID为table1table2(第一个网格为<table id="table1"></table>,第二个网格为<table id="table2"></table>),则jqGrid创建的外部div(具有ui-jqgrid类) )将具有id ="gbox_table1"和id ="gbox_table2"(外部div的ID将基于表ID通过添加前缀"gbox_"来构建).因此,您是否只需要对第一个网格(id ="table1")应用height:60px,然后将CSS规则更改为

The CSS style which you use are applied on both grids because you use classes ui-jqgrid and ui-jqgrid-htable in the CSS rule. The element with the classes exist in both grids. If you want apply some CSS settings on one grid only you can use for example ids. If two grids which you use have ids table1 and table2 for example (you use <table id="table1"></table> for the first grid and <table id="table2"></table> for the second one) then the outer div created by jqGrid (which have ui-jqgrid class) will have id="gbox_table1" and id="gbox_table2" (the id of outer div will be build based on the table id by adding the prefix "gbox_"). So is you need to apply height:60px only for the first grid (with id="table1") then you should change the CSS rule to

#gbox_table1 table.ui-jqgrid-htable {
    height:60px;
}

这篇关于如何添加两个不同的风格的jqgrid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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