Colin Brazier
asked on
Want to sort within multiple groups
I have a working jQuery sort where there is one parent div and one child level of divs.
#tnewsList > .admin_block
I have added an additional layer of divs called .item_group so now I have
#tnewsList > .item_group > .admin_block
I want to be able to move admin_blocks within their existing item_group but not into another item_group, and record the new order, when saved, into my database. The item_groups themselves should not be able to be sorted within the parent #tnewsList.
I attach a piece of my html, and the working jQuery for the two-level html.
Thanks for reading, any help appreciated.
Capture2.JPG
drag_sort_151118_orig.js
#tnewsList > .admin_block
I have added an additional layer of divs called .item_group so now I have
#tnewsList > .item_group > .admin_block
I want to be able to move admin_blocks within their existing item_group but not into another item_group, and record the new order, when saved, into my database. The item_groups themselves should not be able to be sorted within the parent #tnewsList.
I attach a piece of my html, and the working jQuery for the two-level html.
Thanks for reading, any help appreciated.
Capture2.JPG
drag_sort_151118_orig.js
where are you passing 'thisis' variable?
ASKER
Sorry I should have hardcoded that bit.
It comes from the html page here:
and the controller checks $_GET to pass the control on to the correct page.
It comes from the html page here:
<!-- Used in drag n drop -->
<script type="text/javascript">
var thisis;
thisis = "letters" // changes for each category.
</script>
and the controller checks $_GET to pass the control on to the correct page.
ASKER
@sajayj2009
did that help you?
did that help you?
Hi,
are you using the jQuery UI sortable widget? Or any other plugin?
I will have to provide a demo/sample on jsFiddle ...
Thanks
Rainer
are you using the jQuery UI sortable widget? Or any other plugin?
I will have to provide a demo/sample on jsFiddle ...
Thanks
Rainer
ASKER
Yes, jQuery UI sortable widget
Here's what I have been playing about with:
Here's what I have been playing about with:
$('.item_group .admin_block').each(function() {
/*myOrder.push($(this).attr("id"));*/
myOrder.push($(this).sortable('serialize'));
/*serial = $(this).sortable('serialize');*/
serial = $(this).sortable('serialize');
console.log(serial);
});
console.log(myOrder.toString());
console.log(myOrder);
tos_serial = myOrder.toString().serialize;
myo_serial = myOrder.serialize;
console.log(tos_serial);
console.log(myo_serial);
ASKER
jsfiddle would be fine thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I apologise to Rainer.
I am more upset with Sajayj because in my experience the first comment on a question puts a lot of people off as they think it's already being dealt with, and his comment had little to do with what I was asking about. Yes, I should have taken that variable "thisis" out of the code, but I did also pointedly ask him whether my answer to his question had helped, and I never heard back.
Cheers,
Col
I am more upset with Sajayj because in my experience the first comment on a question puts a lot of people off as they think it's already being dealt with, and his comment had little to do with what I was asking about. Yes, I should have taken that variable "thisis" out of the code, but I did also pointedly ask him whether my answer to his question had helped, and I never heard back.
Cheers,
Col
ASKER
I figured it out myself.
If you cannot or do not intend to assist in a question further please let the asker know.
If you cannot or do not intend to assist in a question further please let the asker know.