PDA

View Full Version : How can I initialization reload element by ajax?



luks35
9 Aug 2011, 12:59 PM
Hello (and sorry about my english)!

My question is:

I build application when is tree (left side) and panel with items (right side).
Tree and panel are in viewport container element.
When i click on tree node i want reload right side (all items remove and add new items). This reload must be in ajax (server.php + JSON) and each one node generate new right side view in flight.

So what can i do in extjs 3.4?
My problem is ... i don't know how use code when he comes back in response.
This response code comes back in string and I can't use it as an object, I can't render it.

Please Help someone, thx

httpdotcom
9 Aug 2011, 5:32 PM
Without more information (and code), it would be extremely difficult to advise you on what you need to do.

You could:
- set a beforeclick listener on the treePanel to remove/destroy components in the center/east panel (depending on your layout)
- set a click listener on the treePanel to execute the Ajax call. Then you use the Ajax response to instantiate your new items, using [panelObj].add()

However, if you are reloading data for the objects in the "right" panel, there is no need to remove them. Simply reload() their data stores based on the tree node selected.