Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (android)
Viewing all articles
Browse latest Browse all 7655

TableViewSection with ALLOY in Android

$
0
0

I created a dynamic structure for a tableviewsection in this way index.js

var flag = "";
for ( var i=0, j=response.length; i < j; i++)
{
    if (response[i].section != flag)
    {
        if (data.length > 0)
        {
            var tmp = Alloy.createController('teamsection', { list : data }).getView();
            $.teams.appendSection(tmp);
 
            data = new Array ();
        }
        flag = response[i].section;
    }
 
    data.push(response[i]);
}
index.xml
<Alloy>
    <Window>
        <TableView id="teams">
 
        </TableView>
    </Window>
</Alloy>
teamsection.js
var args = arguments[0] || {};
 
var title = args.list[0].section;
$.section.headerView = Alloy.createController("headerview",{"title": title}).getView();
 
var data = new Array(); 
// Ti.API.info(args.list);
for (var i=0, j=args.list.length; i < j; i++)
{
    $.teamsection.add(Alloy.createController("row",{
        "team": args.list[i].team
    }).getView());
}
teamsection.xml
<Alloy>
  <TableViewSection id="section" />
</Alloy>
headerview.js
var args = arguments[0] || {};
 
var title = args.title || "empty";
 
$.header.text = title;
headerview.xml
<Alloy>
    <View>
        <Label id="header" />
    </View>
</Alloy>
row.js
var args = arguments[0] || {};
 
$.team.title        = args.team;
row.xml
<Alloy>
    <TableViewRow id="team" />
</Alloy>
this code is perfect with iOs, but in Android the sections are not visible...what can I do?

Viewing all articles
Browse latest Browse all 7655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>