Skip to content

Commit b97defd

Browse files
committed
no double json conversion
1 parent e396d1c commit b97defd

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/TableView.jl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ function _showtable(table, dark)
5454

5555
w.dom = dom"div#grid"(className = "ag-theme-balham$(dark ? "-dark" : "")",
5656
style = Dict("width" => "100%",
57-
"min-width" => "400px",
58-
"height" => "800px"))
57+
"height" => "100%",
58+
"min-height" => "200px"))
5959
w
6060
end
6161

6262
function _showtable_sync!(w, names, types, rows, coldefs, tablelength, dark)
6363
options = Dict(
64-
:rowData => table2json(rows, names, types),
64+
:rowData => JSONText(table2json(rows, names, types)),
6565
:columnDefs => coldefs,
6666
:enableSorting => true,
6767
:enableFilter => true,
@@ -71,7 +71,6 @@ function _showtable_sync!(w, names, types, rows, coldefs, tablelength, dark)
7171

7272
handler = @js function (agGrid)
7373
@var gridOptions = $options
74-
gridOptions.rowData = JSON.parse(gridOptions.rowData)
7574
this.table = @new agGrid.Grid(this.dom.querySelector("#grid"), gridOptions)
7675
gridOptions.columnApi.autoSizeColumns($names)
7776
end
@@ -83,13 +82,13 @@ function _showtable_async!(w, names, types, rows, coldefs, tablelength, dark)
8382
rowparams = Observable(w, "rowparams", Dict("startRow" => 1,
8483
"endRow" => 100,
8584
"successCallback" => @js v -> nothing))
86-
requestedrows = Observable(w, "requestedrows", "")
85+
requestedrows = Observable(w, "requestedrows", JSONText("{}"))
8786
on(rowparams) do x
88-
requestedrows[] = table2json(rows, names, types, requested = [x["startRow"], x["endRow"]])
87+
requestedrows[] = JSONText(table2json(rows, names, types, requested = [x["startRow"], x["endRow"]]))
8988
end
9089

9190
onjs(requestedrows, @js function (val)
92-
($rowparams[]).successCallback(JSON.parse(val), $(tablelength))
91+
($rowparams[]).successCallback(val, $(tablelength))
9392
end)
9493

9594
options = Dict(

0 commit comments

Comments
 (0)