课程表

jEasyUI 应用

jEasyUI 拖放

jEasyUI 菜单与按钮

jEasyUI 布局

jEasyUI 数据网格

jEasyUI 窗口

jEasyUI 树形菜单

jEasyUI 表单

jEasyUI 参考手册

工具箱
速查手册

jEasyUI 设置冻结列

当前位置:免费教程 » JS/JS库/框架 » jQuery EasyUI

本实例演示如何冻结一些列,当用户在网格上移动水平滚动条时,冻结列不能滚动到视图的外部。

为了冻结列,您需要定义 frozenColumns 属性。frozenColumn 属性和 columns 属性一样。

  1. $('#tt').datagrid({
  2. title:'Frozen Columns',
  3. iconCls:'icon-save',
  4. width:500,
  5. height:250,
  6. url:'data/datagrid_data.json',
  7. frozenColumns:[[
  8. {field:'itemid',title:'Item ID',width:80},
  9. {field:'productid',title:'Product ID',width:80},
  10. ]],
  11. columns:[[
  12. {field:'listprice',title:'List Price',width:80,align:'right'},
  13. {field:'unitcost',title:'Unit Cost',width:80,align:'right'},
  14. {field:'attr1',title:'Attribute',width:100},
  15. {field:'status',title:'Status',width:60}
  16. ]]
  17. });

您不需要写任何的 javascript 代码,这样您就能创建一个数据网格(datagrid)组件,如下所示:

  1. <table id="tt" title="Frozen Columns" class="easyui-datagrid" style="width:500px;height:250px"
  2. url="data/datagrid_data.json"
  3. singleSelect="true" iconCls="icon-save">
  4. <thead frozen="true">
  5. <tr>
  6. <th field="itemid" width="80">Item ID</th>
  7. <th field="productid" width="80">Product ID</th>
  8. </tr>
  9. </thead>
  10. <thead>
  11. <tr>
  12. <th field="listprice" width="80" align="right">List Price</th>
  13. <th field="unitcost" width="80" align="right">Unit Cost</th>
  14. <th field="attr1" width="150">Attribute</th>
  15. <th field="status" width="60" align="center">Stauts</th>
  16. </tr>
  17. </thead>
  18. </table>

下载 jQuery EasyUI 实例

jeasyui-datagrid-datagrid5.zip

转载本站内容时,请务必注明来自W3xue,违者必究。
 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号