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.
Colin BrazierAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

where are you passing 'thisis' variable?
Colin BrazierAuthor Commented:
Sorry I should have hardcoded that bit.

It comes from the html page here:

<!-- Used in drag n drop -->
<script type="text/javascript">
	var thisis;
	thisis = "letters"  // changes for each category.

Open in new window

and the controller checks $_GET to pass the control on to the correct page.
Colin BrazierAuthor Commented:

did that help you?
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

Rainer JeschorCommented:
are you using the jQuery UI sortable widget? Or any other plugin?
I will have to provide a demo/sample on jsFiddle ...

Colin BrazierAuthor Commented:
Yes,  jQuery UI sortable widget

Here's what I have been playing about with:

$('.item_group .admin_block').each(function() {
					/*serial = $(this).sortable('serialize');*/
					serial = $(this).sortable('serialize');
			tos_serial = myOrder.toString().serialize;
			myo_serial = myOrder.serialize;

Open in new window

Colin BrazierAuthor Commented:
jsfiddle would be fine thanks.
Colin BrazierAuthor Commented:
After a couple of days' work I figured it out myself:

var serial = '';
		$('.item_group').each(function() {
				serial = serial + $(this).sortable('serialize') + '&';  // this will produce a trailing '&' but it is ignored by the processing.

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Colin BrazierAuthor Commented:
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.


Colin BrazierAuthor Commented:
I figured it out myself.

If you cannot or do not intend to assist in a question further please let the asker know.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.