[ALOY-522] Allow <View> to load custom view from a module
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-04-12T23:03:10.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Alloy 1.2.0, 2013 Sprint 08 |
Components | XML |
Labels | notable, qe-testadded |
Reporter | Jeff Haynie |
Assignee | Tony Lukasavage |
Created | 2013-02-17T08:09:07.000+0000 |
Updated | 2014-06-22T13:21:14.000+0000 |
Description
If you want to use Alloy to load a custom view from a module, you have to do it in JavaScript manually in your controller and add to the view hierarchy. Would be nice to be able to do it with XML. (request from TiTokyo) PR - https://github.com/appcelerator/alloy/pull/110 This will be implemented as such
<Alloy>
<Window>
<!--
"module" your UI module's ID.
"method" is the create method use to create an
instance of your UI module. "createView" will be
used if none is specified
-->
<Module id="paint" module="ti.paint" method="createPaintView"/>
</Window>
</Alloy>
Comments
- Mads Moller 2013-04-10
- Tony Lukasavage 2013-04-12 Resolved in: https://github.com/appcelerator/alloy/commit/c82e238d868a9ef3c96c653a96104f82d49111a9
- Tony Lukasavage 2013-04-12
And yes Mads, the
tag will be an alias for a special , meaning it will not return a controller, but instead an actual view allowing you to add children as you would expect. - Mads Moller 2013-04-13 Sweet!
- Bert Grantges 2013-05-30
seeing an error with this:
Alloy 1.1.3-alpha
XML:
Generated Javascript: $.__views.glView = Ti.UI.createModule({ version: 1, backgroundColor: "#aaa", top: 10, left: 10, width: 300, height: 420, depthbuffer: false, multisampling: false, src: "ti.opengl", id: "glView" }); Note that its trying to reference an unknown function createModule vs the expected require / createView. - Tony Lukasavage 2013-05-30 [~bgrantges] you're using the wrong version of Alloy. This isn't available until 1.2.0, as per the fix version of the ticket.
- Bert Grantges 2013-05-30 My bad Tony - misread that as 1.1.2 - I will await the release! Thanks
- Federico Casali 2013-07-24 Sample code available here: https://github.com/appcelerator/alloy/tree/master/test/apps/advanced/native_modules Verified working as expected. Environment: Titanium SDK 3.1.2.v20130718094558 Appcelerator Studio 3.1.2.201307191853 Alloy 1.2.0 Closing.