-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Adrian Salceanu
committed
Aug 28, 2024
1 parent
5e51062
commit 0212b26
Showing
4 changed files
with
103 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
module App | ||
|
||
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 | ||
|
||
@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 = "" | ||
|
||
@onchange isready begin | ||
dt = DataTable(DATA[1:ROWS_PER_PAGE, :]) | ||
filter = "" | ||
end | ||
|
||
@event request begin | ||
loading = true | ||
state = process_request(DATA, dt, pagination, filter) | ||
dt = state.datatable | ||
pagination = state.pagination | ||
loading = false | ||
end | ||
|
||
@onchange filter begin | ||
loading = true | ||
pagination.page = 1 | ||
state = process_request(DATA, dt, pagination[], filter) | ||
dt = state.datatable | ||
pagination = state.pagination | ||
loading = false | ||
end | ||
end | ||
|
||
@page("/", "ui.jl") | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters