Titanium JIRA Archive
Appcelerator Community (AC)

[AC-6634] Android: GridLayout support for ListViews/TableView

GitHub Issuen/a
TypeImprovement
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterMichael Gangolf
AssigneeAbir Mukherjee
Created2020-11-21T15:30:54.000+0000
Updated2020-11-21T15:31:09.000+0000

Description

Since ListView/TableView now supports RecyclerView it is very easy to add simple multi-column support using a GridLayout. TableView:
Ti.UI.backgroundColor = 'white';
var win = Ti.UI.createWindow();

var tableData = [ {title: 'Apples'}, {title: 'Bananas'}, {title: 'Carrots'}, {title: 'Potatoes'}, {title: 'Apples'}, {title: 'Bananas'}, {title: 'Carrots'}, {title: 'Potatoes'} ];

var table = Ti.UI.createTableView({
  data: tableData,
  gridColumns: 1
});
win.add(table);
win.open();
ListView
var win = Ti.UI.createWindow({backgroundColor: 'gray'});
var listView = Ti.UI.createListView({
	gridColumns: 2
});
var sections = [];

var fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits'});
var fruitDataSet = [
    {properties: { title: 'Apple'}},
    {properties: { title: 'Banana'}},
];
fruitSection.setItems(fruitDataSet);
sections.push(fruitSection);

var vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables'});
var vegDataSet = [
    {properties: { title: 'Carrots'}},
    {properties: { title: 'Potatoes'}},
];
vegSection.setItems(vegDataSet);
sections.push(vegSection);

listView.sections = sections;
win.add(listView);
win.open();

var fishSection = Ti.UI.createListSection({ headerTitle: 'Fish'});
var fishDataSet = [
    {properties: { title: 'Cod'}},
    {properties: { title: 'Haddock'}},
];
fishSection.setItems(fishDataSet);
listView.appendSection(fishSection);

Comments

  1. Michael Gangolf 2020-11-21

    PR: https://github.com/appcelerator/titanium_mobile/pull/12284

JSON Source