Search code examples
titaniumtableviewappceleratorappcelerator-mobile

Appcelerator Titanium Alloy: How to set the TableViewStyle to GROUPED in xml


I've tried various things along the lines of (also tried just setting style to GROUPED):

<Alloy>
    <Window title="Add Remember">
        <TableView id="table" style="Ti.UI.iPhone.TableViewStyle.GROUPED">
        <!-->
            <TableViewSection headerTitle="Title">
                <TableViewRow><TextField hintText="Title" id="title"></TextField></TableViewRow>
            </TableViewSection>

            <TableViewSection headerTitle="Location">
                <TableViewRow><TextField hintText="Location" id="location"></TextField></TableViewRow>
            </TableViewSection>

            <TableViewSection headerTitle="Notes">
                <TableViewRow><TextArea hintText="Notes"></TextArea></TableViewRow>
            </TableViewSection>
        </!-->
        </TableView>
    </Window>
</Alloy>

But no shebang.

I've also noticed that setting it programmatically in the controller file works, but only if I haven't added any sections or rows to the TableView yet (this is why the sections and rows are commented out above).

How do I set this property in the xml.


Solution

  • I do it this way:

    In form.xml:

    <TableView class="form">
      ...
    </TableView>
    

    In app.tss:

    ".form": {
      style: Ti.UI.iPhone.TableViewStyle.GROUPED
    }