jsTree v.0.7

A even newer revision is available in the SVN, it includes fixes for almost all comments on this post so far, except for the multitree, which needs a lot of work. A new version will be out soon when I’m done with the documentation and examples.

Version 0.7 is out, though not throughly tested – I will keep testing so bear with me and submit any bugs or strange behavior you encounter.

  • Native support for async data loading is added (either JSON or XML)
  • A new “lock()” function is available to block any user interaction with the tree.
  • Customization of various strings used throughout the code (e.g. “New Folder”, “Loading …”) is now possible – you can now pass your own strings and even assign them to a language version.
  • There is a new hover_mode setting which forces the tree to change only the hover state and not the focus when using the get_* functions (usually used with keyboard shortcuts).
  • The options object is refactored – meaning that your current configs will not be functional!!! I’m sorry for this inconvineince but the options object was getting crowded and messy – now it is divided in groups – you can see a description in the documentation.
  • A setting was added so that now multiple selection is either always on, always off, or based on the Ctrl key (also fixed a couple of bugs with multiple selection).
  • A onrgtclk callback was added – so now you can display your own menu, and prevent the browser default.
  • The optional single-language XML structure is removed!!!. I noticed that nobody used it and it was rather confusing – now the xml structure is the same even if you have, or don’t have language versions.
  • Also a few other bugs were fixed.

All of the new stuff is included in the documentation. I’m working on the examples and downloader. I rushed this version out, as I might not be able to publish anything in the upcoming week. Still, I’ll be thankful for any ideas and critics you may have, so any feedback will be highly appreciated.

Thank you for all your ideas and contributions – I tried to include most of it in this version. If I missed a few things – remind me :). Let’s continue improving jsTree.

Tags: , ,

56 comments to “jsTree v.0.7”

  1. Nostrum says:

    Hi Vakata:

    I have a very curious problem.

    The tree works now perfectly. I can add nodes, delete nodes, call by ajax to my server and get the answer.
    The problem is, when I put in the head:

    The tree now fails:
    Let´s supose we are working on http://www.mysite.com/tree.
    Whe I want to delete a node, the node is deleted, but inmediately the site is redirected to the base href.
    The same when i want to create and when i want to rename.

    I need to use base href, to write the correct ajax urls in this mode:
    $(‘base’).attr(‘href’) + relative_url

    Thank you very much in advance.

  2. Nostrum says:

    Excuse me:

    I don´t know why my last post has deleted the line about href. I was writing about http://www.w3schools.com/TAGS/tag_base.asp

    The line was (I hope let´s see it):

  3. vakata says:

    @Nostrum
    What do you put in the head?
    And can you show me an example?
    I’ll try putting a <base> tag and see what happens.

  4. Nostrum says:

    Hi Vakata:
    I have see the new Jstree site. Congratulations!
    Excuse me for not sending you examples. I have some problem with them. Will work on it ;-).
    But now, I have a different problem. Maybe you can help me.
    As I say you in other post I save node info in the “id” of the node. When i want to create a new node use oncreate callback to call with ajax to server. Then, I change the node “id”, as you say, with
    $(NODE).attr(“id”, data);

    The problem is that now, i want to change the node “id” without using the callback functions. Is there posible?
    Excuse me if this is a very obvious question, but i´m not a javascript programer.
    Thanks in advance!

  5. Nostrum says:

    Obviously, i want to change the currently selected node “id”

  6. Nostrum says:

    I finally have solved this.
    If someone is interested:
    1.- I enabled the cookies in tree init:
    cookies : {prefix : “tree”},
    2.- Now i have the cookie tree_selected wich says me the selected node.
    3.- Whe my own ajax function (external to jstree) returns on his “success” y call to this function ChangeSelectedIDValue(newIDvalues)

    function ChangeSelectedIDValue(newID)
    {
    var myID = document.getElementById($.cookie(‘tree_selected’));
    myID.setAttribute(‘id’,newID);
    }

    So, now i have the id value updated