PDA

View Full Version : Faster 'reload' of a Treepanel data store?



neurodon
23 Oct 2012, 5:41 AM
Hello,

I am building an application that uses a Treepanel/Treestore for a threaded comments feature. Its supposed to update in real time (kind of like Facebooks realtime comment system).

The question I have is: what's the easiest way to do an instant refresh of the treepanel without having to delete all the nodes first? (i.e: clearOnLoad in the treestore).

When I reload it.. there is a noticable delay where the tree dissapears. It's just not that clean.

Previously I was using a Gridpanel (non-threaded comments) and the update was near instant.

Any suggestions?

James Goddard
23 Oct 2012, 6:26 AM
I think you already hit it. Just set 'clearOnLoad' to false and only add/update the new/changed records.

neurodon
23 Oct 2012, 7:15 AM
Is the best way to do this to manually check the store against all of the nodes and update them on 'load'?

James Goddard
23 Oct 2012, 7:17 AM
Is the best way to do this to manually check the store against all of the nodes and update them on 'load'?

If you set clear on load to false the store *should* automatically do that for you as long as your records id's do not change.

Of course the fastest would be to only return the differences from the server.

neurodon
23 Oct 2012, 7:25 AM
Oh okay. I'll mark my 'eventid' field as an ID for the node and I'll see how that works.

neurodon
23 Oct 2012, 7:29 AM
For the record, what is the default ID field? The docs show the 'defaultRootId' field which is set at 'root'. I just want to make sure I'm looking at the right property.

James Goddard
23 Oct 2012, 7:32 AM
The default id field for a model record is 'id'. This can be changed by modifying the 'idProperty' property on the model.