Skip to content

UI.Table

Name - Description Default Type
<input> The value that will be passed to the Columns and Rows shards of the table. [Any]
<output> The output of this shard will be its input. [Any]
Builder Sequence of shards to build each column, repeated for each row. [] [None Shard [Shard]]
Columns Configuration of the columns. None [{Any}]
Striped Whether to alternate a subtle background color to every other row. None Bool&Bool
Resizable Whether columns can be resized within their specified range. None Bool&Bool
RowIndex Variable to hold the row index, to be used within Rows. ContextVariable: Table.RowIndex Int&Int

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
(GFX.MainWindow
 :Contents
 (->
  (Setup
   (GFX.DrawQueue) >= .ui-draw-queue
   (GFX.UIPass .ui-draw-queue) >> .render-steps)
  (UI
   .ui-draw-queue
   (UI.CentralPanel
    :Contents
    (->
     [{:Name "Doe" :Surname "John"}
      {:Name "Dough" :Surname "Jane"}
      {:Name "Smith" :Surname "Dick"}]
     (UI.Table
      :Resizable true
      :Striped true
      :RowIndex .index
      :Columns
      [{:Initial (float 20)}
       {:Header "Surname"
        :Initial (float 100) :AtLeast (float 60) :AtMost (float 160)}
       {:Header "Name"
        :Initial (float 80) :AtLeast (float 60) :AtMost (float 160)}]
      :Builder
      [(-> .index (ToString) (UI.Label))
       (-> (Take "Surname") (UI.Label))
       (-> (Take "Name") (UI.Label))]))))

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

 

 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
(GFX.MainWindow
 :Contents
 (->
  (Setup
   (GFX.DrawQueue) >= .ui-draw-queue
   (GFX.UIPass .ui-draw-queue) >> .render-steps)
  (UI
   .ui-draw-queue
   (UI.CentralPanel
    :Contents
    (->
     [(int2 0) (int2 0 1) (int2 1) (int2 1 0)]
     (UI.Table
      :Columns
      [{:Header "A"}
       {:Header "B"}
       {:Header "A xor B"}]
      :Builder
      [(-> (Take 0) (ToString) (UI.Label))
       (-> (Take 1) (ToString) (UI.Label))
       (-> (| (Take 0) >= .a)
           (| (Take 1) >= .b)
           .a (Math.Xor .b) (ToString) (UI.Label))]))))

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

 

 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
(GFX.MainWindow
 :Contents
 (->
  (Setup
   (GFX.DrawQueue) >= .ui-draw-queue
   (GFX.UIPass .ui-draw-queue) >> .render-steps)
  (UI
   .ui-draw-queue
   (UI.CentralPanel
    :Contents
    (->
     [{:Name "Doe" :Surname "John"}
      {:Name "Dough" :Surname "Jane"}
      {:Name "Smith" :Surname "Dick"}]
     (UI.Table
      :Resizable true
      :Striped true
      :RowIndex .index
      :Columns
      [{:Initial (float 20)}
       {:Header "Surname"
        :Initial (float 100) :AtLeast (float 60) :AtMost (float 160)}
       {:Header
        (-> "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"}))
        :Initial (float 120) :AtLeast (float 100) :AtMost (float 160)}]
      :Builder
      [(-> .index (ToString) (UI.Label))
       (-> (Take "Surname") (UI.Label))
       (-> (Take "Name") (UI.Label))]))))

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