views:

326

answers:

2

I am using a MySQL Nested Set approach to store the classification of the various products that are sold on the website. I am looking for a nice javascript library to help out with rendering the tree from the nested set approach. I also need a good javascript drag and drop script to re-arrange and update the MySQL table.

Are there any good javascript libraries that will let me to do the following the the mysql table that stores values using the nested set model?

  1. Display from the table as a tree
  2. Re-arrange the tree in Javascript and save it into the MySQL table using PHP

I have been trying to get this working with ExtJS/jQuery, etc. I can get the first part working by generating ul, li elements using PHP. I cannot find a Javascript library that will work with nested set and send data to PHP. I tried ExtJS using its Nested Set Model but I didn't have much luck.

A: 

Take a look at jquery plugin for tree displaying: http://www.jstree.com.

JavaScript should not know how to manage NestedSet. It is the php script task to prepare tree for jstree purposes.

FractalizeR
A: 

I know it's not the toolkit you're looking at, but Dojo has a very good and very flexible hierarchical tree component. I'm pretty sure it allows full drag-and-drop rearrangement of elements. If not, it provides the framework for doing it.

I agree with FractalizeR in that the JavaScript doesn't need to care about the method of generating the tree. NestedSet is a technique for relational databases, not interactive trees.

Michael Johnson