【问题标题】:How do I use jQuery sortable for elements in a specific table column only?如何仅对特定表列中的元素使用 jQuery 可排序?
【发布时间】:2012-06-24 09:06:00
【问题描述】:

我正在尝试使用 jQuery 的可拖动和可排序来对表的特定列中列出的元素进行排序。

原因是我本质上是想让人们适应时间段。

我有一张这样的桌子:

<table width="300" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>1:00 PM</td>
    <td><div class="personSortable">Person 1</div></td>
  </tr>
  <tr>
    <td>2:00 PM</td>
    <td><div class="personSortable">Person 2</div></td>
  </tr>
  <tr>
    <td>3:00 PM</td>
    <td><div class="personSortable">Person 3</div></td>
  </tr>
  <tr>
    <td>4:00 PM</td>
    <td><div class="personSortable">Person 4</div></td>
  </tr>
</table>

我想让所有具有“personSortable”类的 div 都可以排序到可用的时间段中。我一直在寻找答案,但我能找到的最接近的方法是使整行可排序(通过使表格成为可排序容器)——这并不理想,因为我无法更改时隙。

我的另一个想法是创建两个 div 包装器:一个带有时隙,一个包含用于人员的可排序 div,并使用 CSS 'float' 属性将它们排列起来。那会是更理想的方法吗?

【问题讨论】:

    标签: jquery html-table draggable jquery-ui-sortable


    【解决方案1】:

    找到这个,如果其他人有兴趣,它似乎可以解决问题:

    http://www.redips.net/javascript/drag-and-drop-table-content/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-10-18
      • 1970-01-01
      • 2019-12-03
      • 1970-01-01
      • 1970-01-01
      • 2017-03-02
      • 2012-01-16
      相关资源
      最近更新 更多