Hello,
I have been intensively looking for an answer for a week. There are a lot of examples out there, how to save results, when having fixed number of lists.
My task is:
I have one 'ul' list, full of items (with id from 1 upwards) queried from MySQL.
And I have several other EMPTY 'ul' lists (with id from 1 upwards) also queried from MySQL.
The task is to distribute items from first list to other lists and save the result in db.
The final outcome should be:
item1 => list2
item2 => list1
item3 => list3
item4 => list3
item5 => list4
item6 => list1 etc.
NOTE: the order of items in the list doesnt matter at all.
current php code goes smth like this:
<?php
echo '<ul id="list0" class="connectedSortable sortable">';
echo ' <li class="ui-state-default" id="entry_'.$team_unique.'">'.$club->club_shortname.' '.$count.'</li>';
echo '</ul>';
$divisions = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."billiards_divisions ORDER BY div_order ASC");
foreach ($divisions as $division) {
$div_id = $division->div_id;
echo '<ul id="list'.$div_id.'" class="connectedSortable sortable" style="height: 260px; width: 170px;">';
echo '<p>'.$division->div_name.'</p>';
echo '</ul>';
}
?>
<script type="text/javascript">
$(function() {
$(".sortable#0, .sortable#<?php $div_id ?>").sortable({
connectWith: '.connectedSortable',
}).disableSelection();
});
</script>
with this i can sort items visually, but i have now idea how to save them. Also if using Ajax, would be nice to see a message: "Item1 has been moved to the list3 and saved"
Any hint would be very appreciated.