Created
May 9, 2012 13:16
-
-
Save iskugor/2644408 to your computer and use it in GitHub Desktop.
Titanium: How to empty table view section
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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