With the experience of Writing user-managed controllers, writing this should not be a problem. However, the article management controller still needs to consider how to write this question, because the view involves classification operations and article operations. This is indeed a tough task. Here, the focus of the problem is that you do not need to split it. According to the principle of loose coupling, it is inevitable to split, but the split is too small, too messy, and it is quite painful to write code, especially for a flexible but less rigorous language like JavaScript.
I don't have much experience in developing large systems, so I always prefer to do whatever I want, so it is convenient and easy to get in the way. Therefore, I am inclined to use a single controller without splitting, if you are interested, you can try splitting it yourself.
In the scripts \ app \ controoler directory, create a controller named content. js. Based on the experience of the controller managed by the user, write the following code:
Ext. Define ('simplecms. Controller. content ',{
Extend: 'ext. App. controller ',
Models :[
'Category', 'categorytree', 'categorycombo ', 'content'
],
Stores :[
'Categoriestree', 'categoriescombo ', 'contents'
],
Views :[
],
Refs :[
],
Init: function (){
Me. Control ({
});
}
});
Code to include all models and stores into the controller. The view has not been created and is not defined yet. The same is true for references.
Switch to the mainpanel controller. Under the activate event listening code of "# contentpanel", delete the console. Log Code and add the following code:
This. application. getcontroller ('content'). INIT ();
In this way, the Controller managed by the article is loaded into the application, and the subsequent work is to load the view in the init method of the article management controller.
Modify the activetab configuration item in the mainpanel view and return it to 0 so that the Article management tab is displayed as the default tab.
So far, the Controller's work has come to an end. The next step is to define the view and then complete the operations on the controller.