0

I am trying to implement the sortable feature to an html table using jquery-ui and I came across an issue.

I need to be able to sort a set of rows belonging to specific topics and sort the rows within that topic as-well. I have done a sample as follows,

What I have for now - jsFiddle

But my concern is how can I allow the items within the topics to be sortable. Currently its sorts only the main topics and you experts' help on this greatly appreciated.

P.S. - I put this together by studying these two samples, Sample 1 - jsFiddle, Sample 2 - jsFiddle

Please excuse if this is a simple question. I am a bit new to this area of development.

2
  • you want both sortable main topic & items within topic? Commented Jul 28, 2015 at 4:36
  • @HiteshSiddhapura yes.. I want the topics to be sortable as a whole which i have now, and the items within the topics to be able to sort also :) Commented Jul 28, 2015 at 4:39

1 Answer 1

1

I have did few changes into html & JavaScript see in JSFiddle

JavaScript Code

$("#sort > tbody").sortable({
    items: 'tr:not(.head)'
}).disableSelection();
$("#sort").sortable({
    items: 'tbody:has(tr)'
}).disableSelection();
Sign up to request clarification or add additional context in comments.

2 Comments

Hi thanks for the answer +1 :) the solution works .. but is this the proper way to do it ?
@Hasitha Yes it is. (if it working fine then select as answer)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.