[ALOY-1179] Support defining controller inheritance in XML
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Runtime, XML |
Labels | TCSupportTriage, inheritance |
Reporter | 曹俊 |
Assignee | Tim Poulsen |
Created | 2014-07-01T02:45:15.000+0000 |
Updated | 2015-01-05T15:43:38.000+0000 |
Description
I would like to be able to specify that subTopBar inherits from topBar by defining the baseController relationship in the XML of subTopBar rather than in its JavaScript code.
--- original description follows ---
There is a super controller which name is 'topBar'.
There is a sub controller which inherit from 'topBar', its name is 'subTopBar'.
'subTopBar' has no XML in any views, because I wanna reuse the view of 'topBar'.
(exports.baseController = 'topBar' )
such as the following .jade file described:
Alloy
View
Require#topBar(src='subTopBar', title='极速开户', top='0')
View(backgroundColor="#f7f7f7", top="44")
When Alloy building, Alloy will try to find the view of the subcontroller when it was required in XML.
1st
I wanna reuse the view, but I cant create a XML in views directory.
2nd
I can still create it in JS by dynamic without any XML of subcontroller.
In a word:
I am for fear to it is a bug.
I think it would be better for you to check this issue, thx.
Attachments
File | Date | Size |
---|---|---|
TestBaseController.zip | 2014-07-02T02:27:43.000+0000 | 5526754 |
Hello @曹俊 please provide a testcase that shows this situation. Thanks!
Test case1 pass Alloy-build. Test case2 fail.
Hi Mauro Parra-Miranda. I upload 2 test case. Environment: Ti 3.2.1, Ti SDK 3.2.2, alloy 1.3.0. Please run on iphone. "testcase1" pass Alloy-build. "testcase2" fail. [INFO] ----- MVC GENERATION ----- [INFO] [global style] writing to cache... [INFO] [index.xml] view processing... [INFO] style: "index.tss" [INFO] view: "index.xml" [ERROR] view "subController" does not exist. Please notice "index.js" in "testcase1" and notice "index.xml" in "testcase2" Because "testcase1" work well and that there is not difference between "testcase1" and "testcase2" in truth. So I think it is a bug or a feature. Thx for your work.
Hi, Testcase1 is well and testcase2 show error but both are logically same. But in testcase2 has little bit mistake, require file didn't exist in view. In testcase2>>view>>index.xml and superController.xml but the reporter code is
Actually code will be.
Hello [~mdsb100]! Let me know if the correction above fixes your issue. Best Regards!
Hi [~morahman], In fact, I want use subController. I can create subController in running time (testcase1). It does not pass the alloy-building if I write "subController" into XML (testcase2). This is problem. The target of the two case is same!
Hi [~mpmiranda], When I define a subController in .xml like "
Inheritance is currently supported when controllers are instantiated in the JavaScript files, but it is not currently supported with XML tags as testcase2 attempts to do. There's reference documentation at http://docs.appcelerator.com/titanium/latest/#!/guide/Alloy_Controllers-section-34636384_AlloyControllers-Inheritance and a sample app at https://github.com/appcelerator/alloy/tree/master/test/apps/advanced/inheritance [~mpmiranda] You can move this to Alloy. However, it is a feature request not a bug.