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] Missing downlevel flags: DownlevelFlags(VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW)
The underlying API or device in use does not support enough features to be a fully compliant implementation of WebGPU. A subset of the features can still be used. If you are running this program on native and not in a browser and wish to limit the features you use to the supported subset, call Adapter::downlevel_properties or Device::downlevel_properties to get a listing of the features the current platform supports.
[warning] DownlevelCapabilities {
    flags: DownlevelFlags(
        COMPUTE_SHADERS | FRAGMENT_WRITABLE_STORAGE | INDIRECT_EXECUTION | BASE_VERTEX | READ_ONLY_DEPTH_STENCIL | NON_POWER_OF_TWO_MIPMAPPED_TEXTURES | CUBE_ARRAY_TEXTURES | COMPARISON_SAMPLERS | INDEPENDENT_BLEND | VERTEX_STORAGE | ANISOTROPIC_FILTERING | FRAGMENT_STORAGE | MULTISAMPLED_SHADING | DEPTH_TEXTURE_AND_BUFFER_COPIES | WEBGPU_TEXTURE_FORMAT_SUPPORT | BUFFER_BINDINGS_NOT_16_BYTE_ALIGNED | UNRESTRICTED_INDEX_BUFFER | FULL_DRAW_INDEX_UINT32 | DEPTH_BIAS_CLAMP | VIEW_FORMATS | UNRESTRICTED_EXTERNAL_TEXTURE_COPIES | SURFACE_VIEW_FORMATS | NONBLOCKING_QUERY_RESOLVE,
    ),
    limits: DownlevelLimits,
    shader_model: Sm5,
}
[warning] Context has 31 commandBuffers at release (0 released, 0 kept)
[warning] Context has 18 buffers at release (2 released, 18 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] Missing downlevel flags: DownlevelFlags(VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW)
The underlying API or device in use does not support enough features to be a fully compliant implementation of WebGPU. A subset of the features can still be used. If you are running this program on native and not in a browser and wish to limit the features you use to the supported subset, call Adapter::downlevel_properties or Device::downlevel_properties to get a listing of the features the current platform supports.
[warning] DownlevelCapabilities {
    flags: DownlevelFlags(
        COMPUTE_SHADERS | FRAGMENT_WRITABLE_STORAGE | INDIRECT_EXECUTION | BASE_VERTEX | READ_ONLY_DEPTH_STENCIL | NON_POWER_OF_TWO_MIPMAPPED_TEXTURES | CUBE_ARRAY_TEXTURES | COMPARISON_SAMPLERS | INDEPENDENT_BLEND | VERTEX_STORAGE | ANISOTROPIC_FILTERING | FRAGMENT_STORAGE | MULTISAMPLED_SHADING | DEPTH_TEXTURE_AND_BUFFER_COPIES | WEBGPU_TEXTURE_FORMAT_SUPPORT | BUFFER_BINDINGS_NOT_16_BYTE_ALIGNED | UNRESTRICTED_INDEX_BUFFER | FULL_DRAW_INDEX_UINT32 | DEPTH_BIAS_CLAMP | VIEW_FORMATS | UNRESTRICTED_EXTERNAL_TEXTURE_COPIES | SURFACE_VIEW_FORMATS | NONBLOCKING_QUERY_RESOLVE,
    ),
    limits: DownlevelLimits,
    shader_model: Sm5,
}
[warning] Context has 31 commandBuffers at release (0 released, 0 kept)
[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] Missing downlevel flags: DownlevelFlags(VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW)
The underlying API or device in use does not support enough features to be a fully compliant implementation of WebGPU. A subset of the features can still be used. If you are running this program on native and not in a browser and wish to limit the features you use to the supported subset, call Adapter::downlevel_properties or Device::downlevel_properties to get a listing of the features the current platform supports.
[warning] DownlevelCapabilities {
    flags: DownlevelFlags(
        COMPUTE_SHADERS | FRAGMENT_WRITABLE_STORAGE | INDIRECT_EXECUTION | BASE_VERTEX | READ_ONLY_DEPTH_STENCIL | NON_POWER_OF_TWO_MIPMAPPED_TEXTURES | CUBE_ARRAY_TEXTURES | COMPARISON_SAMPLERS | INDEPENDENT_BLEND | VERTEX_STORAGE | ANISOTROPIC_FILTERING | FRAGMENT_STORAGE | MULTISAMPLED_SHADING | DEPTH_TEXTURE_AND_BUFFER_COPIES | WEBGPU_TEXTURE_FORMAT_SUPPORT | BUFFER_BINDINGS_NOT_16_BYTE_ALIGNED | UNRESTRICTED_INDEX_BUFFER | FULL_DRAW_INDEX_UINT32 | DEPTH_BIAS_CLAMP | VIEW_FORMATS | UNRESTRICTED_EXTERNAL_TEXTURE_COPIES | SURFACE_VIEW_FORMATS | NONBLOCKING_QUERY_RESOLVE,
    ),
    limits: DownlevelLimits,
    shader_model: Sm5,
}
[warning] Context has 31 commandBuffers at release (0 released, 0 kept)
[warning] Context has 18 buffers at release (2 released, 18 kept)
[warning] Context has 5 textures at release (1 released, 5 kept)