Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8446103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:50:22+00:00 2026-06-10T09:50:22+00:00

I would like to display a fancybox when a user clicks the Create button

  • 0

I would like to display a fancybox when a user clicks the Create button to have them fill in a form. This is used to capture additional data and associate it with the newly created node in jsTree. I need to get the ID of the newly created node and pass it along as a GET parameter in the fancybox call. So far I just can’t seem to figure out how to get the ID.

Here is what I have so far:

    $("#demo").jstree({ 
        // List of active plugins
        "plugins" : ["themes", "json_data", "ui", "crrm", "cookies", "dnd", "search", "types", "hotkeys", "contextmenu", "unique"],

        .bind("create.jstree", function (e, data) {
            $.post(
                "server.php", 
                { 
                    "operation" : "create_node", 
                    "id" : data.rslt.parent.attr("id").replace("node_",""), 
                    "position" : data.rslt.position,
                    "title" : data.rslt.name,
                    "type" : data.rslt.obj.attr("rel")
                }, 
                function (r) {
                    if(r.status) {
                        $(data.rslt.obj).attr("id", "node_" + r.id);
                    }else{
                        $.jstree.rollback(data.rlbk);
                    }
                }
            );
        })

    $("#demo").bind("before.jstree", function (e, data) {
        if(data.func === "create") { 
            var id = data.args[0].attr("id").replace("node_","");
            showFancybox("edit_task.php?action=create&parent_id="+id);
        }
    })

    // Code for the menu buttons
    $(function () { 
        $("#mmenu input").click(function () {
            switch(this.id) {
                case "add_default":
                case "add_folder":
                    $("#demo").jstree("create", null, "last", { "attr" : { "rel" : this.id.toString().replace("add_", "") } });
                    break;
                case "search":
                    $("#demo").jstree("search", document.getElementById("search_text").value);
                    break;
                case "text": break;
                default:
                    $("#demo").jstree(this.id);
                    break;
            }
        });
    });

The code that I have now finds the parent id before the new node is created. I tried waiting a few seconds and then trying to read the newest entry from the database, but this doesn’t work very reliably and is slower than needed. How can I get the new node’s ID from jsTree once it’s been created and added to the database?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T09:50:24+00:00Added an answer on June 10, 2026 at 9:50 am

    This works:

    id = data.args[0].attr("id");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to use Fancybox to display a registration form within an iFrame.
I would like to display the first and last name of the authenticated user.
I would like to display the current position pointer using osmdroid. getController().setCenter(new GeoPoint(location)); This
I would like to display a message before the user disables device admin for
I would like to display a set of Text like this DISCONTINUED (02-02-2012) Crocin
I have an @Ajax.ActionLink which for which I would like display a confirmation dialog
I would like to display characters from this table, http://www.tamasoft.co.jp/en/general-info/unicode.html , in my html-page.
I would like to display an alert when my save button is pressed if
I would like to display details of an xml error log to a user
I would like to display tagcloud in my home page. Found this wordpress flash

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.