Skip to content

Instantly share code, notes, and snippets.

@iskugor
Created May 9, 2012 13:16
Show Gist options
  • Save iskugor/2644408 to your computer and use it in GitHub Desktop.
Save iskugor/2644408 to your computer and use it in GitHub Desktop.
Titanium: How to empty table view section
(function() {
var win = Ti.UI.createWindow({ backgroundColor: "#f00" });
var table = Ti.UI.createTableView();
var rows = [];
for (var i = 0; i < 4; ++i) {
rows.push({ title: "Row 0", header: "Header " + i, className: "Row1" });
for (var j = 0; j < 10; j++) {
rows.push({ title: "Row " + j, className: "Row2" });
}
}
table.setData(rows);
win.add(table);
function emptySection(tableView, sectionIndex) {
var sections = tableView.data;
sections.splice(sectionIndex, 1, Ti.UI.createTableViewSection());
tableView.setData(sections);
}
win.addEventListener("open", function() {
emptySection(table, 1);
});
win.open();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment