今天是:   | 登录中心 | | 网络导航
logo 来海南旅游咨询 海南旅游 预订海南酒店 自驾租车 海南高尔夫 问路订房就请拔打海南旅游百事通  全天24小时为您守候 设为首页
加入收藏
联系站长
导航页为首页
内容页为首页
当前位置:南国风 >> IT.信息技术 >> javascript >> 浏览文章

easyui 行样式定制请看rowstyle.html

作者:佚名 日期:2014年10月10日 来源:本站原创 人气:

easyui   行样式定制请看rowstyle.html

 

 


<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>DataGrid Row Style - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>DataGrid Row Style</h2>
<p>The rows which listprice value is less than 30 are highlighted.</p>
<div style="margin:20px 0;"></div>
<table class="easyui-datagrid" title="DataGrid Row Style" style="width:700px;height:250px"
data-options="
singleSelect: true,
iconCls: 'icon-save',
url: 'datagrid_data1.json',
method: 'get',
rowStyler: function(index,row){
    if (row.listprice < 30){
        return 'background-color:#6293BB;color:#fff;font-weight:bold;';
    }
}//这里的function也可以写在外面  如定义成 setcolorabc   再设定这个值 rowStyler:setcolorabc
">
<thead>
<tr>
<th data-options="field:'itemid',width:80">Item ID</th>
<th data-options="field:'productid',width:100">Product</th>
<th data-options="field:'listprice',width:80,align:'right'">List Price</th>
<th data-options="field:'unitcost',width:80,align:'right'">Unit Cost</th>
<th data-options="field:'attr1',width:250">Attribute</th>
<th data-options="field:'status',width:60,align:'center'">Status</th>
</tr>
</thead>
</table>
 
</body>
</html>
 
 
对列 定制样式 请看 Format DataGrid Columns 的demo
对应演示文件formatcolumns.html
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Format DataGrid Columns - jQuery EasyUI Demo</title>
  6. <link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
  7. <link rel="stylesheet" type="text/css" href="../../themes/icon.css">
  8. <link rel="stylesheet" type="text/css" href="../demo.css">
  9. <script type="text/javascript" src="../../jquery.min.js"></script>
  10. <script type="text/javascript" src="../../jquery.easyui.min.js"></script>
  11. </head>
  12. <body>
  13. <h2>Format DataGrid Columns</h2>
  14. <p>The list price value will show red color when less than 30.</p>
  15. <div style="margin:20px 0;"></div>
  16. <table class="easyui-datagrid" title="Format DataGrid Columns" style="width:700px;height:250px"
  17. data-options="rownumbers:true,singleSelect:true,iconCls:'icon-ok',url:'datagrid_data1.json',method:'get'">
  18. <thead>
  19. <tr>
  20. <th data-options="field:'itemid',width:80">Item ID</th>
  21. <th data-options="field:'productid',width:100">Product</th>
  22. <th data-options="field:'listprice',width:80,align:'right',formatter:formatPrice">List Price</th>
  23. <th data-options="field:'unitcost',width:80,align:'right'">Unit Cost</th>
  24. <th data-options="field:'attr1',width:240">Attribute</th>
  25. <th data-options="field:'status',width:60,align:'center'">Status</th>
  26. </tr>
  27. </thead>
  28. </table>
  29. <script>
  30. function formatPrice(val,row){
  31. if (val < 30){
  32. return '<span style="color:red;">('+val+')</span>';
  33. } else {
  34. return val;
  35. }
  36. }
  37. </script>
  38. </body>
  39. </html>

 


下一篇:没有了
email:lifat@yeah.net| QQ:_3000_99**61 T先生
  服务指南 | 著作权与商标声明 | 法律声明 | 服务条款 | 隐私声明 |


南国风网站的版权信息:保留所有权力

不良信息举报中心!
琼ICP备15001822号