Is there a way to use multiple instances of views in extjs
I've created app that uses two instances of the same view in it. There are two controllers (each controller controls corresponding instance of view). When one of the instances fires event handlers in both controllers are called.
How to manage two instances of the same view to have different stores
then you are in right place.
The problem
You've created view. And now you realize that there is going to be a couple of instances of this view in your app (for example, there is going to be 2 identical grids but having different stores and different event handlers).
I suggest to try one of the two following solutions
Solution
Let's say your view looks like this one:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Also you have 2 stores Store1 and Store2 and two controllers.
Solution 1
In order to manage multiple instances of TestView you may create two additional views:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In this case your viewport should be looking like the following one:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Now you are able to manage both views by controllers using views' xtypes:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Another approach would be to have one view defined (instead of 3 as in a preveous example) but setup viewport so that it would be possible to differentiate instances of the view.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
No comments:
Post a Comment