PDA

View Full Version : TreePanel/AbstractStore.Sync() new record Hierarchy issues (ExtJS 4.1.0-rc3)



WillFM
6 Aug 2012, 6:07 AM
I might just be approaching it the wrong way. But I feel, that the AbstractStore sync issue is greatly flawed in the order in which it submit each new node to the server on a create call.

An example would be I created several new records in a treestore.

-record A //1
--subRecord 1 //2
-record B //3
--subRecord 2 //5
-record C //4
--subRecord 3 //6

The //#, indicates the order in which each item was created in the treepanel before being synced.

Here is what is passed to the server on the create pass of the sync:


{ "Data": [{
"id": "",
"text": "record A",
"clientId": "ext-record-1",
"parentId": "IDFromServer1"
}, {
"id": "",
"text": "subRecord 1",
"clientId": "ext-record-2",
"parentId": ""
}, {
"id": "",
"text": "record B",
"clientId": "ext-record-3",
"parentId": "IDFromServer1"
}, {
"id": "",
"text": "record C",
"clientId": "ext-record-4",
"parentId": "IDFromServer1"
}, {
"id": "",
"text": "subRecord 2",
"clientId": "ext-record-5",
"parentId": ""
}, {
"id": "",
"text": "subRecord 3",
"clientId": "ext-record-6",
"parentId": ""
}]
}

should there not be at least like a clientParentID parameter , being passed to help identify the record associations? else, shouldn't they submit in an order which indicates hierarchy?

What am I missing? I've been avoiding using newer versions of Ext because of a bug in version's passed this with a few events that were broken in later versions that my application was dependent on. but if there is a few or better way to do this in newer releases i may re-evaluate newer versions.

WillFM
14 Aug 2012, 7:14 AM
I've had little luck solving this issue, any input would be appreciated.

mankz
14 Aug 2012, 7:56 AM
Related

http://www.sencha.com/forum/showthread.php?228257-TreeStore-handle-child-phantom-records-wrong&

WillFM
15 Aug 2012, 1:28 PM
I've got a work around working for the time being. on the ItemAppend event for the treepanel, I'm appending the parents internalId, to the new node as a new data value called clientParentId. which is then sent to the server.
This allows it to keep track of the new nodes, and append Id's to them properly to keep my Hierarchy intact