使用 jQuery 对表格列进行拖放排序 [英] Drag and drop sorting of table columns with jQuery

查看:23
本文介绍了使用 jQuery 对表格列进行拖放排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 jQuery 来驱动我的 AJAX UI.我有一个数据表,我想允许用户通过拖放来重新排列表中的列.我希望用户能够抓取列的标题并移动它.下面的数据行应该跟在后面.请注意,我对数据排序或对行重新排序感兴趣,但对允许用户更改列的顺序感兴趣.

I'm using jQuery to drive my AJAX UI. I have a table of data, and I want to allow the user to reorder the columns in the table by dragging and dropping them. I'd like the user to be able to grab the header for a column and move it. The row of data underneath should follow. Note that I'm not interested in sorting the data or in reordering rows, but in allowing the user to change the order of the columns.

有现成的解决方案吗?我尝试在 <th> 元素上使用标准的 jQuery 可排序调用,但这当然不起作用.我浏览了 jQuery 插件站点并没有找到任何东西.我需要写一个 jQuery 插件吗?

Is there an existing solution? I tried using the standard jQuery sortable call on the <th> elements, but of course that doesn't work. I browsed through the jQuery plugins site and didn't find anything. Will I need to write a jQuery plugin?

请注意,jQuery、Dojo 等(免费的)确实是 JS 框架的唯一选择.我无法获得像 ExtJS 这样的商业广告的许可证.

Note that jQuery, Dojo, etc. (the free ones) are really the only option for a JS framework. I can't get a license for anything commercial like ExtJS.

推荐答案

如果你愿意为许可证付费,你可以试试 Ext JS 而不是 jQuery.有一些非常强大的网格功能,包括您正在尝试做的事情.

If you are willing to pay for a license you might try Ext JS instead of just jQuery. There are some pretty powerful grid features that include what you are trying to do.

http://www.extjs.com/deploy/dev/examples/grid/array-grid.html

这篇关于使用 jQuery 对表格列进行拖放排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆