Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Interactive sorting and grouping

Status
Not open for further replies.

jimoblak

Instructor
Oct 23, 2001
3,620
US
I know my PHP and MySQL but am pretty weak on Javascript so I rely on existing frameworks and snippets to get me by. I am currently looking for a way to sort and group elements.

A step in the right direction seems to be found at:
But what I want to do involves the following data example:

id|parent_id|item
1|0|fruits
2|0|vegetables
3|0|apples
4|0|pears
5|0|corn
6|0|Granny Smith

The user would be presented with a list that looks like this:

fruits
vegetables
apples
pears
corn
Granny Smith

The user would then drag elements around so that the database would be instantly updated to this:

id|parent_id|item
1|0|fruits
2|0|vegetables
3|1|apples
4|1|pears
5|2|corn
6|3|Granny Smith

And then the user would see something like this:

fruits
--apples
----Granny Smith
--pears
vegetables
--corn

I'm basically looking for the same functionality of any operating system's method of drag-n-drop file management - - - but I seem to be using the wrong keywords to search for something like this. The examples that I am finding only sort order in a list - - they do not offer the sub-grouping required in this sample.

Can someone point me to a good resource or existing library/framework for this?
 
Sorry - I'm nearsighted. I was looking at Dojo in the drag-drop section but I should have looked in the general widgets for 'tree'.

While I try to wrap my head around Dojo, any other suggestions are still welcome.
 
Jim,

How about the Interface Sortables module for jQuery?

Looks like you'd need to predefine your category blocks (fruits, vegetables, etc.), but the organization is there (click the "serialize" links at foot to see sorted arrays).


--RHYNO
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top