PDA

View Full Version : How to implement a treepanel that can add/delete child and write back to DB?



atreeyang
30 Aug 2009, 1:50 AM
Hi expert,

I am a newbie.

I just get to know how to load the treepanel with json, but the readonly tree is not enough.
How to implement the tree that can add and delete child and can write tree data to database.

Thanks.

Mike Robinson
30 Aug 2009, 5:38 AM
The secret appears to be "ExtJS 3.x and Ext.data.DataWriter."

Surf over to the documentation page, find the description of the save method, click on the method-name (see that it's a hot-link?) and start reading the source-code from here through the bottom of the module. You're looking at code that is tracking the status of the records in the store ("phantom" and/or "dirty"), and firing off asynchronous requests to the host through the "proxy" object. Follow that yellow brick road wherever it takes you.

As your code (directly or indirectly) manipulates the records in the Store object, the Store keeps itself in-sync with the host. It fires off requests and sets up asynchronous success/failure callbacks for each one. And "it just works."