List Class Reference
Overview
This is the main class to add items in a screen. It is used for both normal and editable items. All methods in this class are static. Typically you call methods like List.addItem() followed by a final call to List.show()
List.addItem(label, onclick, style)
Adds a clickable list item. label (string) is the title label, onclick (string) is an optional callback function
List.addItem("John", "viewContact()", "img:contact;icon:arrow");
List.addItemSubtitle(title, subtitle onclick, style)
Adds a list item, with a title (string) a gray subtitle(string), onclick (string) is an optional callback function
List.addItemSubtitle("John", "Sales Manager", "viewContact()", "img:company");
List.addItemLabel(label, value, onclick, style)
Adds a label, value list item. label (string) is displayed in blue and value (string) below it, onclick (string) is an optional callback function.
List.addItemLabel("Email", "john@gmail.com", "App.mail(this.value)");
List.addItemTitle(title, subtitle, onclick, style)
Adds an item with a centered big title (string) am optional subtitle (string) below. onclick (string) is an optional callback function
List.addItemTitle("Total Pipeline Sales", "$67,000", "", "color:white;background-color:" + Color.GREEN);
List.addImage(url, onclick, style)
Adds an image item in the list. url (string) is an absolute http url pointing to an image. onclick (string) is an optional callback function
List.addImage("http://www.upvise.com/img/logo.png", "App.alert('Hi')");
List.addHeader(title, style)
Adds a list item header, which is a non clickable gray separator
List.addHeader("Tools");
List.addTextBox(id, label, value, onchange, style)
Adds an editable text item in the list.
- id (string) is the textbox id. You can reference this value with this.id variable in the onchange callback.
- label (string) is the item label
- value (string) is the initial value
- onchange (string) is the callback function called by the framework when the value has been changed by the user. In this callback, use thethis.id and this.value variables to perform an SQL database update.
- style is an optional string with possible values: text, textarea, date, datetime, url, numeric, decimal, frequency, duration. Default style is text
var task = Query.selectId('tasks', recordid); var onchange = "Query.updateId('tasks',{recordid},this.id,this.value)"; List.addTextBox("name", "Task Name", task.name, onchange); List.addTextBox("duedate", "Due Date", task.duedate, onchange, "datetime");
List.addComboBox(id, label, value, onchange, options)
Adds an editable combo box item in the list.
- id (string) is the combobox id. You can reference this value with this.id variable in the onchange callback.
- label (string) is the item label
- value (string) is the initial value
- onchange (string) is the callback function called by the framework when the value has been changed by the user. In this callback, use the this.id and this.value variables to perform an SQL database update.
- options (string) is a pipe separated list of possible options for the combo in the format: "value1:label1|value2:label2|...."
var task = Query.selectId('tasks', recordid); var onchange = "Query.updateId('tasks',{recordid},this.id,this.value)"; List.addComboBox("status", "Task Status", task.status, onchange, "0:Open|1:Fixed|2:Closed");
List.addComboBoxMulti(id, label, value, onchange, options)
Adds an editable combo box item in the list where use can select multiple values
- id (string) is the combobox id. You can reference this value with this.id variable in the onchange callback.
- label (string) is the item label
- value (string) is the initial value. It is a pipe separator string containing individual value.
- onchange (string) is the callback function called by the framework when the value has been changed by the user. In this callback, use the this.id and this.value variables to perform an SQL database update.
- options (string) is a pipe separated list of possible options for the combo in the format: "value1:label1|value2:label2|...."
var contact = Query.selectId('contacts', recordid); var onchange = "Query.updateId('contacts',{recordid},this.id,this.value)"; List.addComboBoxMulti("groupid", "Contact Group", contact.groupid, onchange, "0:MyTeam|1:Favorite|2:Important");
List.addCheckBox(id, label, checked, onchange)
Adds an checkbox item in the list
- id (string) is the checkbox id, (used in the this.id onchange callback). It must be unique in the screen
- label (string) is the item label
- checked (boolean) is the initial checked state
- onchange (string) is the callback function called by the framework when the value has been changed by the user. In this callback, use the this.id and this.value variables to perform an SQL database update.
var task = Query.selectId('tasks', recordid); var onchange = "Query.updateId('tasks',{recordid},this.id,this.value)"; List.addComboBox("important", "Important", task.important, onchange);
List.addButton(label, onclick, style)
Adds a button item in the list.
List.addToggleBox(id, label, value, onchange, options)
Add a set of toggle buttons (Android only).
List.setValue(id, value)
Set the value (string) of a editable item identified by with id (string)
List.getValue(id)
Returns the string value of the list item value identified with id or null if not found
List.show(style)
display the list and toolbar on the screen. Must be the last call of the List class.
style is an optional string: can be "popup" to display the list as a popup (not added in the history)