Inserting new node in a tree using DataProcessor

Hi,

(we’re using dhtmlxSuite_v26_PRO_100722)

In version 2.5, the following always worked:

tree.insertNewNext(itemid, -1, “new node”);

That is, since we don’t yet know the id of the new node, we just send -1. The server then responds with the actual new node id (as obtained from an sql insert f.ex.)

In version 2.6, the above statement only works once (the first time).
The next time we try to insert a new node where the newItemId is -1, the DataProcessor doesn’t even send a request to the server.

It seems that either the tree or the dataprocessor remembers the -1 itemId and then promptly refuses to send an insert request to the server.

Is this behavior expected?


Bjarnis

Behavior was not changed, after inserting record in DB, response will contain new ID which will be applied to the item.

By the way, the usage of
tree.insertNewNext(itemid, -1, “new node”);
is not very safe

If you will add 2 items in the quick sequence - tree will have two items with the same ID which will lead to errors, as a bit more safe approach you can use

var id = new Date().valueOf(); //pseudo unique id
tree.insertNewNext(itemid, id, “new node”);