23 Oct 2012 10:29 AM #1
Unanswered: Refreshing a Treepanel
I'm trying to refresh a TreePanel so any records updated in the store will sync:
panel.getStore().sync(); panel.getStore().load(); panel.getView().refresh();
The behavior is erratic with this.. what happens is the updated row is successfully added.. but one of the existing rows is duplicated in the view.
For example (this is a threaded comment system):
<User adds comment to the store: CommentNEW>
<Application triggers store update - sync,load,refresh>
The TreeView now displays:
23 Oct 2012 11:29 AM #2
Check your id property and values.
Comment 1 cannot be duplicated in the tree unless both have different id's.
23 Oct 2012 11:56 AM #3
Yeah, thats got to be it.. I'm getting an exception whenever the "error" load happens.
Uncaught TypeError: Cannot read property 'internalId' of undefined
My model has 'internalId' set to my 'eventid' property - which is a GUID style string. I've checked the output from the server.. and all the properties are unique. There is something getting lost in translation between tree loads.
If I can find the source of this exception, I can solve the ID problem... hmm..
P.S: Here is a stack trace of the error.
23 Oct 2012 12:07 PM #4.. and all the properties are unique
in the initial load Comment 1 has an id of xxxx, Commment 2, yyyy, etc
on the reload Comment 1 has an id of qqqq.
As far as the store is concerned you have 2 records with the name "Comment 1" because xxxx != qqqq.
Comment 1 needs to ALWAYS have the same id, which must be unique to other records.