0
我想通过使用jQuery UI和acts_as_list通过拖放进行排序的表。content_tag_for没有通过正确的参数
%tbody#lineup{"data-update-url" => sort_lineups_url}
- @pieces.each_with_index do |piece, index|
= content_tag_for :tr, piece do
= render 'piece', :piece => piece, :index => index
它工作正常,如果我使用ul/li元素但我想使用表(因为它看起来好多了)。但是,当使用table/tr/td时,它不会将更新的顺序传递给javascript可排序函数,即使在拖动+重新排序后,它始终会传递原始顺序。有没有办法通过更新的顺序使用表元素而不是ul/li元素?表格是否支持排序?
编辑:
jQuery ->
$('#faqs').sortable(
axis: 'y'
update: ->
$.post($(this).data('update-url'), $(this).sortable('serialize'))
)
加入我的jQuery的原始发帖 –
很抱歉,如果我没有完全得到它:(所以确实你的表有“常见问题解答”的ID?是否$(“#阵容”)。排序(... )会产生任何结果?你能够拖动行,只是序列化不起作用吗? – Ben
对不起,faqs是一个例子,但使用阵容 –