jQuery EasyUI从入门到精通(19)DataGrid(9)

 时间:2024-10-13 15:12:11

1、DataGrid Cell Style(数倌栗受绽据表格单元格风格),The cells which listprice value 足毂忍珩is less than 30 are highlighted.<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>DataGrid Cell 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 Cell Style</h2> <p>The cells which listprice value is less than 30 are highlighted.</p> <div style="margin:20px 0;"></div> <table class="easyui-datagrid" title="DataGrid Cell Style" style="width:700px;height:250px" data-options=" singleSelect: true, iconCls: 'icon-save', url: 'datagrid_data1.json', method: 'get' "> <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',styler:cellStyler">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> <script type="text/javascript"> function cellStyler(value,row,index){ if (value < 30){ return 'background-color:#ffee00;color:red;'; } } </script></body></html>

jQuery EasyUI从入门到精通(19)DataGrid(9)

2、DataGrid Cell Style(数据表格单元格风格),运行效果如下图所示。

jQuery EasyUI从入门到精通(19)DataGrid(9)

3、Footer Rows in DataGrid钱砀渝测(数据表格的尾行),The summary informations can be displayed in footer rows(汇总信息可以被显示在尾行).<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>Footer Rows in DataGrid - 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>Footer Rows in DataGrid</h2> <p>The summary informations can be displayed in footer rows.</p> <div style="margin:20px 0;"></div> <table class="easyui-datagrid" title="Footer Rows in DataGrid" style="width:700px;height:220px" data-options=" url: 'datagrid_data2.json', method: 'get', fitColumns: true, singleSelect: true, rownumbers: true, showFooter: true "> <thead> <tr> <th data-options="field:'itemid',width:80">Item ID</th> <th data-options="field:'productid',width:120">Product ID</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>

jQuery EasyUI从入门到精通(19)DataGrid(9)

4、Footer Rows in DataGrid(数据表格的尾行),运行效果如下图所示。

jQuery EasyUI从入门到精通(19)DataGrid(9)

5、Merge Cells for DataGrid(数据表格合敛财醣沁并单元格),Cells in DataGrid body can be merged(数据表格体中的单元格可以被合矣喾动痞并).<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>Merge Cells for DataGrid - 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>Merge Cells for DataGrid</h2> <p>Cells in DataGrid body can be merged.</p> <div style="margin:20px 0;"></div> <table class="easyui-datagrid" title="Merge Cells for DataGrid" style="width:700px;height:250px" data-options=" rownumbers: true, singleSelect: true, iconCls: 'icon-save', url: 'datagrid_data1.json', method: 'get', onLoadSuccess: onLoadSuccess "> <thead> <tr> <th data-options="field:'productid',width:100">Product</th> <th data-options="field:'itemid',width:80">Item ID</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:240">Attribute</th> <th data-options="field:'status',width:60,align:'center'">Status</th> </tr> </thead> </table> <script type="text/javascript"> function onLoadSuccess(data){ var merges = [{ index: 2, rowspan: 2 },{ index: 5, rowspan: 2 },{ index: 7, rowspan: 2 }]; for(var i=0; i<merges.length; i++){ $(this).datagrid('mergeCells',{ index: merges[i].index, field: 'productid', rowspan: merges[i].rowspan }); } } </script></body></html>

jQuery EasyUI从入门到精通(19)DataGrid(9)

6、Merge Cells for DataGrid(数据表格合并单元格),运行效果如下图所示。

jQuery EasyUI从入门到精通(19)DataGrid(9)
  • jQuery EasyUI从入门到精通(18)DataGrid(8)
  • jQuery EasyUI从入门到精通(11)DataGrid(1)
  • jQuery EasyUI从入门到精通(16)DataGrid(6)
  • jQuery EasyUI从入门到精通(10)
  • jQuery EasyUI从入门到精通(15)DataGrid(5)
  • 热门搜索
    预防火灾手抄报 中华文化手抄报 关于低碳环保的手抄报 最简单的手抄报 一年级小学生手抄报 国学经典手抄报资料 元宵节手抄报英语版 关于书的手抄报内容 有关文明的手抄报 关于小动物的手抄报