[ALOY-878] <SplitWindow> not recognized when used with formFactor tags
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2013-11-18T14:29:59.000+0000 |
Affected Version/s | Alloy 1.2.2 |
Fix Version/s | n/a |
Components | Appcelerator Studio, Titanium SDK |
Labels | Alloy, Studio |
Reporter | Jamil Spain |
Assignee | Tony Lukasavage |
Created | 2013-11-18T02:38:12.000+0000 |
Updated | 2014-02-28T23:57:14.000+0000 |
Description
I have the following index.xml view:
I'm working on a formFactor tags with iphone and ipad layouts using formfactor tags. Whichever one is second never gets processed. If I switch the SplitWindow to be before the tag, it gets processed but when you start the iphone layout, it won't get processed.
Attaching a test project. Working on some work with Citi Group and had some questions about iPad / SplitWindow workings with Alloy.
Attachments
File | Date | Size |
---|---|---|
SplitWindowTest.zip | 2013-11-18T02:38:12.000+0000 | 9197032 |
What does "it doesn't get processed" mean? It doesn't generate code? It throws an error? I need more specifics to understand what is going on here. I'll work with it in the meantime, but a little more detail would be helpful.
It throws an error: 'undefined' is not an object ( evaluating '$.index.open') at index.js ( line ## )
I think it's looking for this line to be in the (!Alloy.isTablet ) block that would be evaluating for iPhone. on Line 52 it calls the $.index.open(); $.__views.index && $.addTopLevelView($.__views.index); Here is the output from the index.js controller in Resources folder: https://gist.github.com/jamilspain-appc/7528528
I assume you haven't given explicit IDs to the Window or SplitWindow? This is why you are getting some kind of error (still not clear though since you didn't say exactly what is happening). You can't use the automatic ID to apply to multiple elements when the conditional you are using is a runtime conditional, like form factor, since this can't be determined at compile time. You need to give an explicit ID to your components and this will work just fine. Here's a slight modification of your case that works just fine for iphone and ipad, regardless of the order of elements.
index.xml
index.js
Gotcha.. so as a general rule for trainings, it's just best to just assign explicit IDs to top level objects and that will always work no matter what the situation. If you don't, then the only use case that will work for ( the automatic ID ) is with a single top level object in a View Layout. Sound accurate, any more exceptions?
Yeah, that might be the safest bet. The only situation this should occur in is if you have multiple top level elements that are relying on the auto id of the controller name AND you are using runtime conditionals on them (like form factor). A very specific case you managed to find. ;-)