i'm saving my tree in sql db but i'm not really satisfied about my
solution. Actions like rename and delete are ajax requests and make a
direct update in db. Changes in structure and node create have to be
saved by button. After pushing the save button the following happens:
Clear db tree and set auto_increment = 1 and run through the json. The
problem is, if i want to save some other properties which concern the
tree like url or template etc i have to make a second "backup table"
where the properties are saved a second time because every structure
change cause a tree delete.
I thought about changing every node id after changing structure and
update the tree db.
example: i load the following tree from db
1
----- 2
----- 3
----- 4
i add a new node and give id 5:
1
----- 2
----- 5
----- 3
----- 4
Now the tree ids have to be ordered and then saved to db.
The point is, one way is to make the order by auto increment (deletes
the whole tree and build it again) or to try holding the order in the
jstree and just make updates.
The problem is i have to make ajax request after every drag and drop
to preserve the structure. The over point is i have to do the same if
i create a new node.
Someone have probably some proposals how i fix my problem or has
probably the same problem.
--
You received this message because you are subscribed to the Google Groups "jsTree" group.
To post to this group, send email to jst...@googlegroups.com.
To unsubscribe from this group, send email to jstree+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jstree?hl=en.
Yes Chris, i've tried that before too but i don't like to work with
flags, the code becomes difficult to read for over developer.
On 23 Jan., 16:31, John Arrowwood <jarro...@gmail.com> wrote:
> I have the same basic issue: I have to tap into every event and make an
> update to my backing data structure. That's just what you need to do.
>
> You CAN save the whole tree every time, but that is ridiculously expensive
> from a performance standpoint, especially if you have a large tree. And
> it's not really the right way to do it.
>
> Question is, why do you need to change node ID's? The callback indicates
> where in the tree it was created (right?) so why not update an 'order'
> column in the database, so that when you need to display the tree again, and
> in the right order, you just sort by the order field. You don't have to
> change the node ID's.
>
> > jstree+un...@googlegroups.com<jstree%2Bunsu...@googlegroups.com>