@@ -52,13 +52,20 @@ Return a `WebIO.Scope` that displays the provided `table`.
5252
5353Optional arguments:
5454 - `dark`: Switch to a dark theme.
55+ - `title`: Displayed above the table if non-empty;
5556 - `height`/`width`: CSS attributes specifying the output height and with.
5657 - `cell_changed`: Either `nothing` or a function that takes a single argument with the fields
5758 `"new"`, `"old"`, `"row"`, and `"col"`. This function is called whenever the
5859 user edits a table field. Note that all values will be strings, so you need to
5960 do the necessary conversions yourself.
6061"""
61- function showtable (table, options:: Dict{Symbol, Any} = Dict {Symbol, Any} (); dark = false , height = :auto , width = " 100%" , cell_changed = nothing )
62+ function showtable (table, options:: Dict{Symbol, Any} = Dict {Symbol, Any} ();
63+ dark:: Bool = false ,
64+ title:: String = " " ,
65+ height = :auto ,
66+ width = " 100%" ,
67+ cell_changed = nothing
68+ )
6269 rows = Tables. rows (table)
6370 tablelength = Base. IteratorSize (rows) == Base. HasLength () ? length (rows) : nothing
6471
@@ -148,10 +155,23 @@ function showtable(table, options::Dict{Symbol, Any} = Dict{Symbol, Any}(); dark
148155 end
149156
150157 id = string (" grid-" , string (uuid1 ())[1 : 8 ])
151- w. dom = dom " div" (className = " ag-theme-balham$(dark ? " -dark" : " " ) " ,
158+ w. dom = dom " div" (
159+ dom " div" (
160+ title,
161+ style = Dict (
162+ " background-color" => dark ? " #1c1f20" : " #F5F7F7" ,
163+ " color" => dark ? " #F5F7F7" : " #1c1f20" ,
164+ " height" => isempty (title) ? " 0" : " 18px" ,
165+ " padding" => isempty (title) ? " 0" : " 5px" ,
166+ " font-family" => """ -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif"""
167+ )
168+ ),
169+ dom " div" (className = " ag-theme-balham$(dark ? " -dark" : " " ) " ,
152170 style = Dict (" width" => to_css_size (width),
153171 " height" => to_css_size (height)),
154- id = id)
172+ id = id
173+ )
174+ )
155175
156176 showfun = async ? _showtable_async! : _showtable_sync!
157177
0 commit comments