Skip to content

Instantly share code, notes, and snippets.

@lukaskollmer
Last active December 26, 2016 20:27
Show Gist options
  • Select an option

  • Save lukaskollmer/ce1535bb2985a3c26b024aa17e19372b to your computer and use it in GitHub Desktop.

Select an option

Save lukaskollmer/ce1535bb2985a3c26b024aa17e19372b to your computer and use it in GitHub Desktop.
Example of ui.TableView in the Scripter app
const ui = require("ui");
class MyTableView extends ui.TableView {
constructor() {
super("grouped");
this.title = "Choose your Doctor";
this.names = [
"Christopher Eccleston",
"David Tennant",
"Matt Smith",
"Peter Capaldi"
];
this.numberOfSections = () => {
return 1;
}
this.numberOfRowsInSection = (section) => {
return this.names.length;
}
this.cellForRowInSection = (section, row) => {
return {
title: this.names[row],
detail: "",
backgroundColor: "white",
titleTextColor: "black",
detailTextColor: "black",
titleFont: "system",
detailFont: "system"
}
}
this.didSelect = (section, row) => {
console.log(`Did select ${this.names[row]}`);
}
}
}
var table = new MyTableView();
table.present("sheet");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment