Skip to content

UI.Table

Name Mandatory Description Default Type
⬅️ Input The values that will be passed to the Columns and Rows shards of the table, or number of items in the sequence. Int[Any]
Output ➡️ The output of this shard will be its input. Int[Any]
Columns No Column definitions with headers and content. none [Shard [Shard]]
Striped No Whether to alternate a subtle background color to every other row. false BoolVar(Bool)
Resizable No Whether columns can be resized within their specified range. false BoolVar(Bool)
Reversed No Whether the table is reversed. false BoolVar(Bool)
IsSelected No Callback function for checking if a row is currently selected. none Shard[Shard]
Clicked No Callback function for when a row is clicked. none Shard[Shard]
DoubleClicked No Callback function for when a row is double-clicked. none Shard[Shard]
ContextMenu No Callback function for the right-click context menu on rows. none Shard[Shard]
RowHeight No Height of each row in pixels. Default is text height. none FloatVar(Float)None

Table layout.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
GFX.MainWindow(
  Contents: {
    Once({
      GFX.DrawQueue >= ui-draw-queue
      GFX.UIPass(ui-draw-queue) >> render-steps
    })
    UI(
      UI.CentralPanel(
        Contents: {
          [{Name: "Doe" Surname: "John"}
            {Name: "Dough" Surname: "Jane"}
            {Name: "Smith" Surname: "Dick"}] = seq
          Count(seq) | UI.Table(
            Resizable: true
            Striped: true
            Columns: [
              {
                UI.TableHeader({
                  "Index" | UI.Label
                } WidthType: "exact" Width: 20.0)
                ToString | UI.Label
              }
              {
                UI.TableHeader({
                  "Surname" | UI.Label
                } WidthType: "initial" Width: 100.0 MinWidth: 60.0 MaxWidth: 160.0)
                = i
                seq | Take(i) | Take("Surname") | UI.Label
              }
              {
                UI.TableHeader({
                  "Name" | UI.Label
                } WidthType: "initial" Width: 80.0 MinWidth: 60.0 MaxWidth: 160.0)
                = i
                seq | Take(i) | Take("Name") | UI.Label
              }]
          )
        }
      )
    ) | UI.Render(ui-draw-queue)

    GFX.Render(Steps: render-steps)
  }
)

[warning] Context has 22 buffers at release (2 released, 22 kept)
[warning] Context has 5 textures at release (1 released, 5 kept)
 

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
GFX.MainWindow(
  Contents: {
    Once({
      GFX.DrawQueue >= ui-draw-queue
      GFX.UIPass(ui-draw-queue) >> render-steps
    })
    UI(
      UI.CentralPanel(
        Contents: {
          [@i2(0) @i2(0 1) @i2(1) @i2(1 0)] = data
          Count(data) | UI.Table(
            Columns: [
              {
                UI.TableHeader({
                  "A" | UI.Label
                } WidthType: "auto")
                = i
                data | Take(i) | Take(0) | ToString | UI.Label
              }
              {
                UI.TableHeader({
                  "B" | UI.Label
                } WidthType: "auto")
                = i
                data | Take(i) | Take(1) | ToString | UI.Label
              }
              {
                UI.TableHeader({
                  "A xor B" | UI.Label
                } WidthType: "remainder")
                = i
                {
                  data | Take(i) | Take(0) >= a
                  data | Take(i) | Take(1) >= b
                  a | Math.Xor(b) | ToString | UI.Label
                }
              }]
          )
        }
      )
    ) | UI.Render(ui-draw-queue)

    GFX.Render(Steps: render-steps)
  }
)

[warning] Context has 4 buffers at release (2 released, 4 kept)
[warning] Context has 5 textures at release (1 released, 5 kept)
 

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
GFX.MainWindow(
  Contents: {
    Once({
      GFX.DrawQueue >= ui-draw-queue
      GFX.UIPass(ui-draw-queue) >> render-steps
    })
    UI(
      UI.CentralPanel(
        Contents: {
          [{Name: "Doe" Surname: "John"}
            {Name: "Dough" Surname: "Jane"}
            {Name: "Smith" Surname: "Dick"}] = seq
          Count(seq) | UI.Table(
            Resizable: true
            Striped: true
            Columns: [
              {
                UI.TableHeader({
                  "Index" | UI.Label
                } WidthType: "exact" Width: 20.0)
                ToString | UI.Label
              }
              {
                UI.TableHeader({
                  "Surname" | UI.Label
                } WidthType: "initial" Width: 100.0 MinWidth: 60.0 MaxWidth: 160.0)
                = i
                seq | Take(i) | Take("Surname") | UI.Label
              }
              {
                UI.TableHeader({
                  "Name" | UI.Label(Style: {text_style: "Heading"})
                  UI.Button("Up" Msg("Clicked Up") Style: {text_style: "Small"})
                  UI.Button("Down" Msg("Clicked Down") Style: {text_style: "Small"})
                } WidthType: "initial" Width: 120.0 MinWidth: 100.0 MaxWidth: 160.0)
                = i
                seq | Take(i) | Take("Name") | UI.Label
              }]
          )
        }
      )
    ) | UI.Render(ui-draw-queue)

    GFX.Render(Steps: render-steps)
  }
)

[warning] Context has 22 buffers at release (2 released, 22 kept)
[warning] Context has 5 textures at release (1 released, 5 kept)