Skip to content

Commit

Permalink
#67 allow to optionally use ag-grid enterprise
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Baumgold committed Mar 22, 2021
1 parent 33b451e commit 4b265c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions deps/build.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version = readchomp(joinpath(@__DIR__, "..", "ag-grid.version"))
distribution = haskey(ENV, "AG_GRID_LICENSE_KEY") ? "enterprise" : "community"
println("building: distribution=$distribution version=$version")

isdir(joinpath(@__DIR__, "ag-grid-$(version)")) || mkdir(joinpath(@__DIR__, "ag-grid-$(version)"))

Expand Down
10 changes: 6 additions & 4 deletions src/TableView.jl
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,15 @@ end

function _showtable_sync!(w, schema, names, types, rows, coldefs, tablelength, id, options)
options[:rowData] = JSONText(table2json(schema, rows, types))
license = get(ENV, "AG_GRID_LICENSE_KEY", nothing)
handler = @js function (RowNumberRenderer, agGrid)
@var gridOptions = $options
@var el = document.getElementById($id)
gridOptions.components = Dict(
"rowNumberRenderer" => RowNumberRenderer
)
if $(haskey(ENV, "AG_GRID_LICENSE_KEY"))
agGrid.LicenseManager.setLicenseKey($(ENV["AG_GRID_LICENSE_KEY"]))
if $(!isnothing(license))
agGrid.LicenseManager.setLicenseKey($license)
end
this.table = @new agGrid.Grid(el, gridOptions)
gridOptions.columnApi.autoSizeAllColumns()
Expand Down Expand Up @@ -239,6 +240,7 @@ function _showtable_async!(w, schema, names, types, rows, coldefs, tablelength,
,
"rowCount" => tablelength
)
license = get(ENV, "AG_GRID_LICENSE_KEY", nothing)

handler = @js function (RowNumberRenderer, agGrid)
@var gridOptions = $options
Expand All @@ -247,8 +249,8 @@ function _showtable_async!(w, schema, names, types, rows, coldefs, tablelength,
gridOptions.components = Dict(
"rowNumberRenderer" => RowNumberRenderer
)
if $(haskey(ENV, "AG_GRID_LICENSE_KEY"))
agGrid.LicenseManager.setLicenseKey($(ENV["AG_GRID_LICENSE_KEY"]))
if $(!isnothing(license))
agGrid.LicenseManager.setLicenseKey($license)
end
this.table = @new agGrid.Grid(el, gridOptions)
gridOptions.columnApi.autoSizeAllColumns()
Expand Down

0 comments on commit 4b265c1

Please sign in to comment.