Skip to content

Commit

Permalink
Merge branch 'tables-auto-pagination' into v0.23-compat-quasar1
Browse files Browse the repository at this point in the history
# Conflicts:
#	demos/tables/app2.jl
  • Loading branch information
Adrian Salceanu committed Sep 2, 2024
2 parents fe6f85f + 545a0a2 commit 17ff66f
Show file tree
Hide file tree
Showing 6 changed files with 209 additions and 64 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "StippleUI"
uuid = "a3c5d34a-b254-4859-a8fa-b86abb7e84a3"
authors = ["Adrian Salceanu <[email protected]>"]
version = "0.23.3"
version = "0.23.4"

[deps]
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
Expand All @@ -22,10 +22,10 @@ StippleUIDataFramesExt = "DataFrames"
Colors = "0.12"
DataFrames = "1"
Dates = "1.6"
Genie = "5.23.8"
Genie = "5.30.4"
OrderedCollections = "1"
PrecompileTools = "1"
Stipple = "0.28.11"
Stipple = "0.28.14"
Tables = "1"
julia = "1.6"

Expand Down
6 changes: 3 additions & 3 deletions demos/tables/app.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ using DataFrames
@genietools

@app begin
NO_OF_ROWS = 1000
DATA = sort!(DataFrame(rand(NO_OF_ROWS, 2), ["x1", "x2"]))
ROWS_PER_PAGE = 10
NO_OF_ROWS = 1_000_000
DATA = sort!(DataFrame(rand(NO_OF_ROWS, 2), ["x1", "x2"]))::DataFrame # we only sort so that the changes are more visible when filtering and paginating
ROWS_PER_PAGE = 100

@out df = DATA
@out dt = DataTable(DataFrame([]), DataTableOptions(DATA))
Expand Down
39 changes: 11 additions & 28 deletions demos/tables/app2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,23 @@ using GenieFramework
using DataFrames
@genietools

@app begin
NO_OF_ROWS = 1000
DATA = sort!(DataFrame(rand(NO_OF_ROWS, 2), ["x1", "x2"]))::DataFrame # we only sort so that the changes are more visible when filtering and paginating
ROWS_PER_PAGE = 10
StippleUI.Tables.set_default_rows_per_page(20)
StippleUI.Tables.set_max_rows_client_side(11_000)

@out df = DATA
@out dt = DataTable(DataFrame([]), DataTableOptions(DATA))
@out pagination = DataTablePagination(rows_per_page = ROWS_PER_PAGE, rows_number = NO_OF_ROWS)
@out loading = false
@in filter = ""
@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

@onchange isready begin
dt = DataTable(DATA[1:ROWS_PER_PAGE, :])
filter = ""
end
@out dt1 = DataTable(big_data; server_side = true)
@out dt2 = DataTable(big_data)

@event request begin
loading = true
state = process_request(DATA, dt, pagination, filter)
dt = state.datatable
pagination = state.pagination
loading = false
end
@out loading = false

@onchange filter begin
loading = true
pagination.page = 1
state = process_request(DATA, dt, pagination, filter)
dt = state.datatable
pagination = state.pagination
loading = false
@event dt1_request begin
@paginate(dt1, big_data)
@push
end
end

@page("/", "ui.jl")
@page("/", "ui2.jl")

end
29 changes: 29 additions & 0 deletions demos/tables/ui2.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
table(:dt1,
server_side = true,
loading = :loading,
title = "Server side data"
)
table(:dt2,
loading = :loading,
title = "Client side data"
)

# ParsedHTMLString("""
# <q-table
# row-key="__id"
# :loading="loading"
# :columns="dt2.columns"
# title="Random data"
# :data="dt2.data"
# :filter="dt2.filter"
# :pagination.sync="dt2.pagination"
# v-model="dt2">
# <template v-slot:top-right>
# <q-input dense debounce="300" v-model="dt2.filter" placeholder="Search">
# <template v-slot:append>
# <q-icon name="search" />
# </template>
# </q-input>
# </template>
# </q-table>
# """)
11 changes: 11 additions & 0 deletions demos/tables/ui2.jl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<q-table row-key="__id" :loading="loading" :columns="dt.columns" title="Random data" :data="dt.data"
v-on:request="function(event) { handle_event(event, 'dt_request') }" :filter="dt.filter"
:pagination.sync="dt.pagination">
<template v-slot:top-right>
<q-input dense debounce="300" v-model="dt.filter" placeholder="Search">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
</template>
</q-table>
Loading

2 comments on commit 17ff66f

@essenciary
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/114363

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.23.4 -m "<description of version>" 17ff66ff202f15e75aba8b4c766c72912c91e2c9
git push origin v0.23.4

Please sign in to comment.