Extjs4--- app(controller和application)相关问题
2012-04-17 20:26
309 查看
Controller中refs中的解释:
In the
you can set up references to view instances. This allows you to retrieve and manipulate components on the page inside of your controller’s actions. To describe the component that you want to reference, you can use a ComponentQuery inside the selector property.
The other required information inside of this object is the
This will be used as part of the name of the getter that will be generated automatically for each item inside the refs array. For example, by defining
Alternatively, if you did not set up a reference inside your controller, you could continue to use
of the controller actions. However, we discourage you from doing this because it forces you to manage unique component ID's in your project, often leading to problems as your project grows.
It’s important to remember that these getters will be created independent of whether the view actually exists on the page. When you call the getter and the selector successfully matches a component on the page, it caches the result so that subsequent calls
to the getter will be fast. However, when the selector doesn’t match any views on the page, the getter will return null. This means that if you have logic that depends on a view and there is a possibility that the view does not exist on the page yet, you need
to add a check around your logic to ensure it only executes if the getter returned a result. In addition, if multiple components match the selector, only the first one will be returned. Thus, it’s good practice to make your selectors specific to the single
view you wish to get. Lastly, when you destroy a component you are referencing, calls to the getter will start returning null again until there is another component matching the selector on the page.
app.application和app.controller中getter自动方法的需要注意的问题:
It’s important to note that the getters for both views and models return a reference to the class (requiring you to instantiate
your own instances), while the getters for stores and controllers return actual instances.
In the
refsconfiguration,
you can set up references to view instances. This allows you to retrieve and manipulate components on the page inside of your controller’s actions. To describe the component that you want to reference, you can use a ComponentQuery inside the selector property.
The other required information inside of this object is the
refproperty.
This will be used as part of the name of the getter that will be generated automatically for each item inside the refs array. For example, by defining
ref: 'stationsList'(note the capital L), a getter will be generated on the controller called
getStationsList.
Alternatively, if you did not set up a reference inside your controller, you could continue to use
Ext.getCmpinside
of the controller actions. However, we discourage you from doing this because it forces you to manage unique component ID's in your project, often leading to problems as your project grows.
It’s important to remember that these getters will be created independent of whether the view actually exists on the page. When you call the getter and the selector successfully matches a component on the page, it caches the result so that subsequent calls
to the getter will be fast. However, when the selector doesn’t match any views on the page, the getter will return null. This means that if you have logic that depends on a view and there is a possibility that the view does not exist on the page yet, you need
to add a check around your logic to ensure it only executes if the getter returned a result. In addition, if multiple components match the selector, only the first one will be returned. Thus, it’s good practice to make your selectors specific to the single
view you wish to get. Lastly, when you destroy a component you are referencing, calls to the getter will start returning null again until there is another component matching the selector on the page.
app.application和app.controller中getter自动方法的需要注意的问题:
It’s important to note that the getters for both views and models return a reference to the class (requiring you to instantiate
your own instances), while the getters for stores and controllers return actual instances.
相关文章推荐
- ExtJS中app(controller,application)相关问题
- WeX5学习笔记-创建本地APP相关问题
- 与adb相关的问题,比如掉线问题、Android Studio 提示Session 'app':Error Installing APK、找不到设备
- 与adb相关的问题,比如掉线问题、Android Studio 提示Session 'app':Error Installing APK、找不到设备
- S5PV210 FirstAndroidAPP] ERROR: Application requires API version 版本不对的问题
- Android关于Theme.AppCompat相关问题的深入分析
- Xcode8.1 cocoa application中关于View Controller下设置项"Is Initial Controller"的问题
- APP相关问题汇总
- Windows 8 系列(五):Windows App Cer Kit(Certification Kit)的使用与相关问题
- Android 6.0 运行中手动去设置界面取消该app的某个权限,导致application被强制销毁造成app崩溃问题的解决
- Android关于Theme.AppCompat相关问题的解决方案
- Eclipse 更新Android SDK后,新建项目出现appcompat_v7工程的相关问题
- 读取app.config配置的相关问题
- android-support-v7-appcompat.jar 的安装及相关问题解决
- pp助手安装app出现“ApplicationVerificationFailed”问题的解决
- iOS APP应用图标的相关问题
- Android关于Theme.AppCompat相关问题的深入分析
- 关于Microsoft Unified Communications Managed API 3.0开发的相关技术问题(UserEndpoint 、ApplicationEndpoint的区别是什么?)
- 解决数据标准及质量AppScan(测试)安全性问题相关方法
- Application windows are expected to have a root view controller at the end of application launch问题分析