Titanium JIRA Archive
Alloy (ALOY)

[ALOY-522] Allow <View> to load custom view from a module

GitHub Issuen/a
TypeImprovement
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-04-12T23:03:10.000+0000
Affected Version/sn/a
Fix Version/sAlloy 1.2.0, 2013 Sprint 08
ComponentsXML
Labelsnotable, qe-testadded
ReporterJeff Haynie
AssigneeTony Lukasavage
Created2013-02-17T08:09:07.000+0000
Updated2014-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

  1. Mads Moller 2013-04-10

  2. Tony Lukasavage 2013-04-12

    Resolved in: https://github.com/appcelerator/alloy/commit/c82e238d868a9ef3c96c653a96104f82d49111a9
  3. 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.
  4. Mads Moller 2013-04-13

    Sweet!
  5. 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.
  6. 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.
  7. Bert Grantges 2013-05-30

    My bad Tony - misread that as 1.1.2 - I will await the release! Thanks
  8. 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.

JSON Source