From 545a0a24bf956137efc19f65d8c214fc838b7801 Mon Sep 17 00:00:00 2001 From: Adrian Salceanu Date: Mon, 2 Sep 2024 16:25:44 +0200 Subject: [PATCH] Improved support for server side tables, version bump --- Project.toml | 2 +- demos/tables/app2.jl | 12 +++++------- demos/tables/ui2.jl | 32 ++++++++++++++++++++++++-------- demos/tables/ui2.jl.html | 2 +- src/Tables.jl | 34 +++++++++++++++++++++++++--------- 5 files changed, 56 insertions(+), 26 deletions(-) diff --git a/Project.toml b/Project.toml index 4cf7d609..5b81acce 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "StippleUI" uuid = "a3c5d34a-b254-4859-a8fa-b86abb7e84a3" authors = ["Adrian Salceanu "] -version = "0.23.3" +version = "0.23.4" [deps] Colors = "5ae59095-9a9b-59fe-a467-6f913c188581" diff --git a/demos/tables/app2.jl b/demos/tables/app2.jl index f5684bba..866d97b4 100644 --- a/demos/tables/app2.jl +++ b/demos/tables/app2.jl @@ -4,25 +4,23 @@ using GenieFramework using DataFrames @genietools -StippleUI.Tables.set_max_rows_client_side(2000) +StippleUI.Tables.set_default_rows_per_page(20) +StippleUI.Tables.set_max_rows_client_side(11_000) @app begin big_data = sort!(DataFrame(rand(1_000_000, 2), ["x1", "x2"]))::DataFrame # we only sort so that the changes are more visible when filtering and paginating - small_data = sort!(DataFrame(rand(1_001, 2), ["y1", "y2"]))::DataFrame - @out dt1 = DataTable(big_data; rows_per_page = 20) - @out dt2 = DataTable(small_data; rows_per_page = 20, server_side = false) + @out dt1 = DataTable(big_data; server_side = true) + @out dt2 = DataTable(big_data) @out loading = false - @event paginate_dt1 begin + @event dt1_request begin @paginate(dt1, big_data) @push end - end -# @page("/", "ui2.jl.html") @page("/", "ui2.jl") end \ No newline at end of file diff --git a/demos/tables/ui2.jl b/demos/tables/ui2.jl index b7924bb6..fe462863 100644 --- a/demos/tables/ui2.jl +++ b/demos/tables/ui2.jl @@ -1,13 +1,29 @@ table(:dt1, - paginationsync = Symbol("dt1.pagination"), - @on("request", :paginate_dt1), + server_side = true, loading = :loading, - filter = Symbol("dt1.filter"), - title = "Random big data" + title = "Server side data" ) table(:dt2, - paginationsync = Symbol("dt2.pagination"), loading = :loading, - filter = Symbol("dt2.filter"), - title = "Random small data" -) \ No newline at end of file + title = "Client side data" +) + +# ParsedHTMLString(""" +# +# +# +# """) diff --git a/demos/tables/ui2.jl.html b/demos/tables/ui2.jl.html index 41b55fc1..b49a255f 100644 --- a/demos/tables/ui2.jl.html +++ b/demos/tables/ui2.jl.html @@ -1,5 +1,5 @@