zoukankan      html  css  js  c++  java
  • jQuery拖动调整表格列宽度-resizableColumns

    版权声明:本文为博主原创文章,未经博主同意不得转载。

    https://blog.csdn.net/itmyhome/article/details/26718525

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


    一、引入文件:

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

    二、TABLE

    <table id="myTable" border="1"> 
       <thead> 
        <tr> 
         <th data-resizable-column-id="a"><input type="checkbox" /></th> 
         <th data-resizable-column-id="b">栏目类型 </th> 
         <th data-resizable-column-id="c">活动名称 </th> 
         <th data-resizable-column-id="d">状态 </th> 
         <th data-resizable-column-id="e">操作选项</th> 
        </tr> 
       </thead> 
       <tbody> 
        <tr> 
         <td><input type="checkbox" /></td> 
         <td>青春日记</td> 
         <td>2014年度青春日记征文 </td> 
         <td>提交 </td> 
         <td>审核</td> 
        </tr> 
        <tr> 
         <td><input type="checkbox" /></td> 
         <td>我和孩子的成长故事</td> 
         <td>成长故事 </td> 
         <td>通过 </td> 
         <td>审核</td> 
        </tr> 
       </tbody> 
    </table>
    以上html仅仅是作为Demo 并非我项目中所实际使用的,而且在測试的时候  也未能实现。

    郁闷...


    三、实现表格可拖动

    <script type="text/javascript">
        $(function(){
    	$("#myTable").resizableColumns({
    	     store: window.store
    	});
        })
    </script>

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

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

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

    分别解压两个文件

    jquery.resizableColumns.js在jquery-resizable-columns-gh-pagesdist路径下

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


    ------------------------切割线----------------------------


    假设未实现效果。可使用 colResizable 插件

    參考: http://blog.itmyhome.com/2016/05/jquery-colresizable  


                                                                                 2016-05-05

  • 相关阅读:
    建造者(Builder)模式
    模板方法模式(Tempalte Method Pattern)
    NIO Socket编程实例
    Java NIO概述
    转:Java中的Clone()方法详解
    调停者(Mediator)模式
    门面(Facade)模式
    struts2中方法拦截器(Interceptor)的中的excludeMethods与includeMethods的理解
    Struts2默认拦截器配置
    struts2的json-default和struts-default的区别
  • 原文地址:https://www.cnblogs.com/ldxsuanfa/p/10057108.html
Copyright © 2011-2022 走看看