Last active
December 26, 2016 20:27
-
-
Save lukaskollmer/ce1535bb2985a3c26b024aa17e19372b to your computer and use it in GitHub Desktop.
Example of ui.TableView in the Scripter app
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
| 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