Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1080] Compiler fails with misleading message when dataCollection set on ListView rather than ListSection

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-07-23T15:06:46.000+0000
Affected Version/sAlloy 1.4.0, Alloy 1.3.1
Fix Version/sAlloy 1.5.0
ComponentsXML
Labelsqe-manualtest
ReporterTim Poulsen
AssigneeFeon Sua Xin Miao
Created2014-07-09T13:49:04.000+0000
Updated2014-09-14T21:08:56.000+0000

Description

If the dataCollection attribute is set on the ListView, as shown below, the Alloy compiler fails with the message that the ItemTemplate must have a name attribute (which it does in the example).
<Alloy>
  <Collection src="mycollection"/>
  <Window id="win">
    <ListView id="thelist" defaultItemTemplate="listTemplate" dataCollection="mycollection">
      <Templates>
        <ItemTemplate name="listTemplate">
          <Label bindId="mylabel" id="mylabel"/>
        </ItemTemplate>
      </Templates>
      <ListSection id="mainsection">
      </ListSection>
    </ListView>
  </Window>
</Alloy>
Moving the dataCollection attribute to the ListSection tag resolves the issue. This might be primarily a documentation issue -- that the list section is what you bind to your collection. However, the error message should be more meaningful and accurate.

Attachments

FileDateSize
Screen Shot 2014-07-09 at 9.19.59 AM.png2014-07-09T13:49:05.000+000091600

Comments

  1. Feon Sua Xin Miao 2014-07-22

    PR: https://github.com/appcelerator/alloy/pull/490 Test app: https://github.com/feons/alloy/tree/ALOY-1080/test/apps/testing/ALOY-1080 Functional Test: Run the test app, Alloy compilation should fail with an error message identify the problem that dataCollection attribute is set on ListView.
  2. Tim Poulsen 2014-07-23

    PR merged
  3. Federico Casali 2014-09-14

    Error received using the sample code is:
       [INFO] :   ----- MVC GENERATION -----
       [INFO] :   [global style] writing to cache...
       [INFO] :   [models/fruits.js] model processing...
       [INFO] :   [index.xml] view processing...
       [INFO] :   style:      "index.tss"
       [INFO] :   view:       "index.xml"
       [ERROR] :  Error with <ListView> at line 4
       [ERROR] :  'dataCollection' attribute should be set on <ListSection>.
       [ERROR] :  Alloy compiler failed
       
    TiSDK 3.4.0.v20140913174915 Appcelerator Studio 3.4.0.201409131030 CLI 3.4.0-rc3 Alloy 1.5.0-rc2 Xcode6 GM Closing

JSON Source