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条)

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!