jQuery UI Widgets Forums Navigation Tree Item position in the tree

This topic contains 3 replies, has 2 voices, and was last updated by  Dimitar 10 years, 8 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Item position in the tree #55995

    mikesantos
    Participant

    Hello

    Is there any property or method that allows me to know the position number of each item in the tree? I need to save this position in a column into a table database, so the next time the user loads the tree the items will be at the same position he left.

    thank you

    Item position in the tree #56005

    Dimitar
    Participant

    Hello mikesantos,

    Do you mean that you reorder the tree and want to keep the new item order? Unfortunately, saving/loading the tree’s state is not supported. There is, however, a workaround by a user, which can be found in the forum topic JQxTree save state?? It seems to save only the expanded/collapsed state of items, though.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Item position in the tree #56035

    mikesantos
    Participant

    I have found that there is an array in the tree object that returns all itens in their respective order. Doing something like this will return me this array:

    var items = $(this)[0].items;

    I tried to use this with the dragEnd event, but unfortunelly, the order of the items it returns is the one before the drag and not the final order after the drag. This is very frustating.

    Another point that I don’t understand is the allowDrop Property. Is there any case where you would want to drag an item and not drop it? At first, when I found this property in the documentation I thought it could serve to not allow the drop of other itens inside a specific item, that would be very usefull, but I think there is no implementation for this type of thing too, only if you return false in dropEnd, right?

    Thank you

    Item position in the tree #56038

    Dimitar
    Participant

    Hi mikesantos,

    The allowDrop property is useful when you have multiple trees and you wish to be able to drop tree items only on some of them.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.