Difference between revisions of "UI.Table"
From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2023.1<br/> '''Class:''' UI<br/> === Description === Creates a Table widget. <syntaxhighlight lang="lua"> UI.Table.new(columns,di...") |
|||
Line 50: | Line 50: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | {{ | + | {{UI}} |
Latest revision as of 07:20, 17 October 2023
Available since: Gideros 2023.1
Class: UI
Description
Creates a Table widget.
UI.Table.new(columns,direction,cellSpacingX,cellSpacingY,fixed)
Parameters
columns: (table) the Table widget columns definition
direction: (bool) is it an horizontal Table widget (default = false)
cellSpacingX: (number) the Table widget cell spacing on the x axis
cellSpacingY: (number) the Table widget cell spacing on the y axis
fixed: (bool) is it a fixed Table widget (if true please provide cellSpacingX and cellSpacingY values) (default = false)
Example
local cols={
{ name="First name",field="first",weight=2},
{ name="Last name",field="last",weight=2},
{ name="Song",field="song",weight=3},
}
local rows = {
{ first="Paul", last="McCartney", song="Maybe I'm Amazed"},
{ first="Ringo", last="Starr", song="Photograph"},
{ first="George", last="Harrison", song="My Sweet Lord"},
{ first="John", last="Lennon", song="Imagine"},
}
local gui = UI.Table.new(cols, false, 64, 32, true)
gui:setData(table.clone(rows))
--gui:setLayoutConstraints({fill=Sprite.LAYOUT_FILL_HORIZONTAL, anchor=Sprite.LAYOUT_ANCHOR_NORTHWEST})
gui:setDimensions(256, 96)
gui:setColor(0x5c5c5c)
gui:setPosition(50, 50)
gui:setAllowColumnResize(true)
gui:setAllowColumnReorder(true)
local index = #rows+1
table.insert(rows,index,{ first="Pauline", last="Croze", song="Jour de foule"})
gui:setData(table.clone(rows))
local screen=UI.Screen.new() -- needed to add the table
screen:ui(gui)
- UI.Accordion
- UI.Animation
- UI.Bar
- UI.Behavior
- UI.Border
- UI.BreadCrumbs
- UI.Builder
- UI.Button
- UI.Calendar
- UI.Checkbox
- UI.Combobox
- UI.ImageText
- UI.Keyboard
- UI.Label
- UI.Panel
- UI.Progress
- UI.Slider
- UI.Spinner
- UI.Splitpane
- UI.TabbedPane
- UI.Table
- UI.TextField
- UI.TimePicker
- UI.Toolbox
- UI.Tree
- UI.Viewport
- UI.WeekSchedule