jqGrid的使用

在jqGrid使用bootstrap4 会出现找不到字体,因为bootstrap4以后之前使用的字体收费,已经不使用了。。但是jqgrid在使用bootstrap的ui css时,有些图标会显示不出来,从而 我们需要指定jqgrid使用bootstrap4的 style,并指定某一种图标字体

可选的字体有

GitHub Octicons, Iconic and free Font Awesome.

https://octicons.github.com/

https://useiconic.com/icons/

https://fontawesome.com/icons?d=gallery&m=free

具体使用方法如下例所示:

<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="utf-8" />
   <!-- A link to a Bootstrap css 这里是用的bootstrap4(4以上的也可以)-->
   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">     
   <!-- A link to a Octicons css 使用octicons字体图标 -->
   <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/font/octicons.css">

<!--这个是fontawsome字体图标,也可以使用这个,不过jqgrid初始化是要对应指定fontawsome
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
-->
   <!-- A link to a jqGrid Bootstrap 4 css  jqgrid里要使用bootstrap4对应的-->
   <link rel="stylesheet" type="text/css" media="screen" href="../../../css/trirand/ui.jqgrid-bootstrap4.css" />

   <!-- The jQuery library is a prerequisite for all jqSuite products -->
   <script type="text/ecmascript" src="../../../js/jquery.min.js"></script>

   <!-- This is the localization file of the grid controlling messages, labels, etc.
   <!-- We support more than 40 localizations  grid的字体-->
   <script type="text/ecmascript" src="../../../js/trirand/i18n/grid.locale-cn.js"></script>
   <!-- This is the Javascript file of jqGrid jqgrid的js -->   
   <script type="text/ecmascript" src="../../../js/trirand/jquery.jqGrid.min.js"></script>
   <!-- Optional Bootstrap JavaScript files 弹出窗口的-->
   <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<!--bootstrap版本使用的是4以上的--->
   <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>


<script>
//这里要制定使用bootstrap的4版本的样式
$.jgrid.defaults.styleUI = 'Bootstrap4';
//指定使用的字体图标,当然也可以使用fontAwesome等,但是引用的css要使用对应的
$.jgrid.defaults.iconSet = 'Octicons';

//$.jgrid.defaults.iconSet = "Iconic";      
//$.jgrid.defaults.iconSet = "fontAwesome";
</script>
</head>
<body>
...
</body>
</html>

 

参考文献:

jqgrid的使用: http://www.guriddo.net/documentation/guriddo/javascript/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值