Welcome Guest, Not a member yet? Register   Sign In
Jquery Drag and Drop to create menu (similar to wordpress custom menus)
#1

[eluser]Dan Tdr[/eluser]
Hello,

I want to create a similar effect to the one in the custom menu in wordpress 3.0+
What i want:
I want to be able to create a custom menu via drag and drop (with or without sub elements)
I need to have all my pages in a list and be able to add them and order them via drag and drop

I found: http://papermashup.com/drag-drop-with-php-jquery/ a great sorting via drag and drop tutorial(with files included) but it does not allow me to add new elements or remove any of them.
I found a little more and i found: http://tutorialzine.com/2009/09/shopping...hp-jquery/ but again this one lets me add and remove items but does not let me sort them the way i need.

Once added, the element should be removed from the list and show only in the menu.

I was wandering if anyone can point me into the right direction, or help in any way, or maybe someone already did this kind of thing or has an idea of how it should be.

Thank you,
Dan
#2

[eluser]Dan Tdr[/eluser]
i found something that, i think would fit exactly to what i want, but i'm not an expert in JSON so i don't know hot to configure it. :
http://www.prodevtips.com/2010/03/07/jqu...sort-tree/

this is just a bit of code.
Code:
$("#save").click(function(){
        /*
        var tree = $.toJSON(parseTree($("#tag_tree")));
        $.post("@saveTags", {tags: tree}, function(res){
            $("#printOut").html(res);
        });
        */
        $.debug.print_r(parseTree($("#tag_tree")), "printOut", false);
    });

on save it outputs :

Code:
'0' => "Economics"
    '1' => "Blogging"
    '2' => "General Dev"
    '3' => "Japan"
    '4' ...
        '0' => "Productivity"
        '1' ...
            '0' ...
                '0' => "Humanities"
    '3' => "CMS"

the author says that with the commented code you can save the data in the database but i can't seem to figure out how to do that.
I just need to pass the id, parent id(if exists or 0 if not), and order




Theme © iAndrew 2016 - Forum software by © MyBB