View Full Version : Trigger component to update with different config

30 Jan 2012, 9:11 AM
I've extended a few types, such as grid and form into my own types and then I wrap these in a component for easy code reuse. So for users, or locations or whatever the type might be it's a simple job to create a new page with all the grid and edit form wired up for you.

I've added a popup button in the top right of the viewpoint for modifying the site settings a bit like what Google has with it's little cog icon. One of the settings is turning infinite scrolling on or off as an example. Infinite scrolling is currently defined in the config of the extended type. My question is two pronged really.

1. How can I modify the config block of the extended type to include one or the other bit of config based on a global bool flag such as infiniteScroll.

2. Inside a listener handler, how can I force a component and it's contained components to recreate recreate themselves from their config. So this stems from the above question when I'll change the flag and then want the config to run again. I was hoping doLayout would do this but unfortunately it doesn't.

Thanks in advance!

30 Jan 2012, 11:30 AM
I don't think you are going to have much success with turning infinite scrolling off. You can use reconfigure on the grid to assign a new store but the body height needs to be refreshed.

Normally you don't have a component recreate itself. There are methods on the components to change behavior but if you need to change a large chunk then it may be best to destroy it and then reinstaniate a new instance.