dongxie1907 2011-04-07 13:33
浏览 58
已采纳

jQuery UI可排序的php / mysql

I have been working on a sortable list. I want to implement a sortable list like this: http://jqueryui.com/demos/sortable/#connect-lists-through-tabs

It is the ajax communication, that I'm really stuck with.

I have set up a jsfiddle, http://jsfiddle.net/pnrAx/, showing my current code. (Note, it is copy and paste with loads of junk, cleanup needed)

The fields, updating the information on each row are working fine, no problems there. The sorting also works on the screen, I can drag-n-drop items nicely.

To boil the problem down, how can I get the sorted elements from the page, with ajax (json?), into an array on a php page?

From there, it should be pretty easy to update the table.

  • 写回答

2条回答 默认 最新

  • dongye8110 2011-04-07 13:49
    关注

    what i would do is when you output then html put them into arrays like this

    <input type="hidden" name="block[369][id]" value="369"/>
    <input type="hidden" name="block[369][menuBolk_id]" value="55"/>
    <input type="hidden" name="block[369][matstovuID]" value="39"/>
    <input type="text" name="block[369][Heiti]" value="Big Burgara Matskrá" style="width: 60%; font-weight: bold; padding: 4px; line-height: 150%; font-size: 12pt; background-color: #ccc;"/>
    <textarea style="width: 60%; background-color: #ccc;" name="Vorulysing"></textarea>
    <div style="margin-top: -70px; padding-bottom: 70px;">
        <input type="text" name="block[369][Pris][]" value="Kr 83,-" class="price priceR" style="width: 10%;"/>
        <input type="text" name="block[369][Pris][]" value="" class="price priceC" style="width: 10%;"/>
        <input type="text" name="block[369][Pris][]" value="" class="price priceL" style="width: 10%;"/>
    </div>
    

    then when you poste you will have a post of "block" which will be a multi dimensional array

    so in this instance what you want is to submit them all at once and process them in the order they are revived so the user would sort then hit a submit button and the form would submit all post data in the the order in which they have sorted them. Does that make sense ?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测