jQuery拖动调整表格列宽度-resizableColumns

实现鼠标可拖动调整表格列宽度 如图:


一、引入文件:

  1. <script src="/js/jquery-1.8.0.min.js" type="text/javascript"></script>  
  2. <script src="/js/store.js" type="text/javascript"></script>  
  3. <script src="/js/jquery.resizableColumns.js" type="text/javascript"></script>  

二、TABLE
  1. <table id="myTable" border="1">   
  2.    <thead>   
  3.     <tr>   
  4.      <th data-resizable-column-id="a"><input type="checkbox" /></th>   
  5.      <th data-resizable-column-id="b">栏目类型 </th>   
  6.      <th data-resizable-column-id="c">活动名称 </th>   
  7.      <th data-resizable-column-id="d">状态 </th>   
  8.      <th data-resizable-column-id="e">操作选项</th>   
  9.     </tr>   
  10.    </thead>   
  11.    <tbody>   
  12.     <tr>   
  13.      <td><input type="checkbox" /></td>   
  14.      <td>青春日记</td>   
  15.      <td>2014年度青春日记征文 </td>   
  16.      <td>提交 </td>   
  17.      <td>审核</td>   
  18.     </tr>   
  19.     <tr>   
  20.      <td><input type="checkbox" /></td>   
  21.      <td>我和孩子的成长故事</td>   
  22.      <td>成长故事 </td>   
  23.      <td>通过 </td>   
  24.      <td>审核</td>   
  25.     </tr>   
  26.    </tbody>   
  27. </table>  
以上html只是作为Demo 并不是我项目中所实际使用的,并且在测试的时候   也未能实现。郁闷...


三、实现表格可拖动

[javascript] view plain copy 在CODE上查看代码片 派生到我的代码片
  1. <script type="text/javascript">  
  2.     $(function(){  
  3.     $("#myTable").resizableColumns({  
  4.          store: window.store  
  5.     });  
  6.     })  
  7. </script>  

在项目使用过程中 发现无需引入store.js <th>也无需data-resizable-column-id属性

并且$("#myTable").resizableColumns();也可实现功能

所需文件下载地址:http://download.csdn.net/detail/itmyhome/7390263

分别解压两个文件

jquery.resizableColumns.js在\jquery-resizable-columns-gh-pages\dist路径下

store.js在store.js-master路径下

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值