-
21 Feb 2013 8:47 AM #1
Profiles and inheritance. What's the best practice?
Profiles and inheritance. What's the best practice?
Let's say I have the following views:
View1
Child1
Child2
Child views extend View1.
Now I need to introduce profiles for both View1 and Child1 and things will look like this:
View1
Child1
Child2
/phone/View1/tablet/
Child1View1The problem, of course is that now "phone.Child1" extends Child1 only and doesn't get any of the methods of the super class View1.
Child1
Is the best practice to mix in the "phone.View1" class?
Code:Ext.define('phone.Child1', { extend: 'Child1', mixins: { profileMixin: 'phone.View1' },Olivier - interfaSys
Developing custom solutions for BlackBerry 10 using Sencha Touch.
-
23 Feb 2013 7:06 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
Are there methods in the phone.View1 that is going to be used in other classes?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
23 Feb 2013 8:52 AM #3
Yes, all the methods of the super class which are specific to that profile.
Per example, View1 had a onItemSwipe method which Child1 and Child2 were calling.
Now onItemSwipe has been implemented in the profiles, so in "phone.View1" and "tablet.View1".
So "phone.Child1" will need the super methods of "phone.View1", but also the ones of non-profile specific "Child1".Olivier - interfaSys
Developing custom solutions for BlackBerry 10 using Sencha Touch.
-
23 Feb 2013 1:08 PM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
You could use mixin or just extend each other... phone.Child1 extends phone.View1, phone.View1 extends Child1
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.


Reply With Quote