使用拖放功能重新排序HTML表格行 [英] Reorder HTML table rows using drag-and-drop

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

问题描述

我有一个jQuery函数来上下移动表格行.我不知道如何保存数据,也不知道每一行的位置.我正在使用PHP显示表行.

I have a jQuery function to move table rows up and down. I do not know how to save the data, nor get the position of each row. I am using PHP to show the table rows.

当用户对表行重新排序时,如何获取每个表行位置值?

How do I get each table row position value when the user reorders the table rows?

推荐答案

感谢Jim Petkus给了我一个很好的答案.但是我试图解决自己的脚本,而不是将其更改为另一个插件.我的主要重点不是使用独立的插件,而只是通过使用jquery核心来完成我想要的事情!

thanks to Jim Petkus that did gave me a wonderful answer . but i was trying to solve my own script not to changing it to another plugin . My main focus was not using an independent plugin and do what i wanted just by using the jquery core !

猜猜我确实发现了问题.

and guess what i did find the problem .

var title = $("em").attr("title");
$("div").text(title);

这是我添加到脚本中的内容,并且将自爆代码添加到html部分:

this is what i add to my script and the blew codes to my html part :

<td> <em title=\"$weight\">$weight</em></td>

并找到每行$ weight值

and found each row $weight value

再次感谢吉姆·佩特库斯

thanks again to Jim Petkus

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

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