我檢查了這些:多拖動可放開和排序的jQuery
Jquery draggable/droppable and sortable combined
jQuery UI: sortable and draggable + sortable and droppable
JQuery Draggable + Droppable + Sortable
所以,答案是沒有這些。
理論
- 我有2個元件,UL和OL。
- UL的列表項在OL去
- OL可排序
問題
- 我有多個這樣的UL和OL單頁上。
- 我需要確保UL的列表項不會輸入其他部分的OL。
你有什麼試過的?
$(function() {
$(".fetchedfromdb li").draggable({
appendTo: "body",
helper: "clone",
drag: function(){
$(".sortintodb ol").droppable({
activeClass: "ui-state-default",
hoverClass: "ui-state-hover",
accept: ":not(.ui-sortable-helper)",
drop: function(event, ui) {
$(this).find(".placeholder").remove();
$("<li></li>").text(ui.draggable.text()).appendTo(this);
}
}).sortable({
sort: function() {
$(this).removeClass("ui-state-default");
}
});
}
});
});
我笨部分:
<?php
echo form_open('/data/process');
echo form_label('yep') . form_textarea('remarks');
foreach($dataFetched as $data => $field) {
echo "<h2>$data</h2> \n <ul class='fetchedfromdb'>";
foreach($field as $f):
$fieldFetch = $data.'_1_1';
echo '<li>'.$f->$fieldFetch.'</li>';
echo "<br />";
endforeach;
echo '</ul>';
echo '<div style="background-color: #c3c3c3; height:100px">';
echo "<ol class=\"sortintodb\" id=\"$data\">";
echo '<li class="placeholder">Drop here</li>
</ol>
</div><hr />';
}
echo form_submit('submit','Submit');
echo form_close();
?>
通過CSS我已經確定,每一個輸出,直到家長的foreach結束自帶根據同款
有關這可怎麼實現的任何想法?
任何幫助,非常感謝。謝謝:)
什麼,我們正在尋找...
非常感謝! – Ankit