-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FR] SearchBuilder works with Server-Side processing mode #963
Comments
Unfortunately, you can't use the server-processing mode with SearchBuilder at the present. The good news is, it's possible now. We will consider to implement this feature. **Note for myself: ** we need to translate the following "searchBuilder" JSON message to R expression. {"method":"update","data":{"tbl_state":{"time":1644504799036,"start":0,"length":10,"order":[],"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true},"columns":[{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}}],"childRows":[],"searchBuilder":{"criteria":[{"condition":"=","data":"Sepal.Width","type":"num","value":["3"]},{"condition":">","data":"Petal.Length","type":"num","value":["5"]}],"logic":"AND"},"page":0}}} 1644504799.0447066 quick examplelibrary(shiny)
tbl = data.frame(
COL_INT = 1:20,
COL_DBL = as.double(101:120),
COL_FAC = as.factor(LETTERS[1:20]),
COL_STR = letters[1:20],
COL_DATE = Sys.Date() + 1:20,
COL_TIME = Sys.time() + (1:20) * 3600 * 24
)
ui = fluidPage(
DT::DTOutput("tbl")
)
server = function(input, output, session) {
output$tbl = DT::renderDT({
DT::datatable(
tbl, options = list(dom = "Qlfrtip"),
extensions = c("SearchBuilder", "DateTime")
)
})
}
runApp(list(ui=ui, server=server))
|
That would be really helpful, Thanks. |
The full condition possibilitiesBut there's one issue need to be resolved first:The conditions "=", ">=" and "<=" are encoded without properly "quote", thus on the Shiny side (I mean in the Ajax callback), the query content would be "", ">" and "<" only. shiny::parseQueryString("searchBuilder[criteria][0][condition]=<=&searchBuilder[criteria][0][data]=COL_INT")
#> $`searchBuilder[criteria][0][condition]`
#> [1] "<"
#>
#> $`searchBuilder[criteria][0][data]`
#> [1] "COL_INT" Opening the developper tools, I find that the browser indicates the original data contains the "=" sign. The "=" sign in the query string should be encoded as "%3D" but I'm not sure it's an issue of datatable itself or it's a DT issue. @yihui any thoughts? |
@yihui , my investigation finds it could be a bug of DT, as the browser sends out correct encoded strings (in Chrome I can see the raw POST content). Lines 559 to 562 in cccd35e
Removing the |
Hello, I see that this ticket is still open and it seems that the SearchBuilder DT extension does not work when |
@isthisthat For now, due to limited resources, I'd say it's unlikely for us to implement it unless someone else implements it and sends a PR. Sorry! |
Thanks for confirming! |
@AhmedKhaled945 @isthisthat Great news: @mikmart has generously helped implement this feature! Now you can install the development version via remotes::install_github('rstudio/DT') and try it out. Thanks everyone! |
It works!! Amazing work @mikmart !! Thank you |
Hello, so a really helpful extension added to this repo was SearchBuilder, and while using it, once i go to server processing mode (server = true), it doesn't work, and this is a must on my side because i am dealing with fairly large data,
So is there any solution for this?, whether to optimize the data flow on client side (server = false) or to make the extension work on server side processing?
Regards,
By filing an issue to this repo, I promise that
xfun::session_info('DT')
. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('rstudio/DT')
.I understand that my issue may be closed if I don't fulfill my promises.
The text was updated successfully, but these errors were encountered: