I am trying to use this JS script (from this website: Fuzzy Search Plug-in) in a DT datatable:
var fsrco = $('#fuzzy-ranking').DataTable({
fuzzySearch: {
rankColumn: 3
},
sort: [[3, 'desc']]
});
fsrco.on('draw', function(){
fsrco.order([3, 'desc']);
});
Using this script tag:
"//cdn.datatables.net/plug-ins/1.11.3/features/fuzzySearch/dataTables.fuzzySearch.js"
I want to incorporate it in a DT datable function within a Shiny app where the fuzzy search is applied using the rank order (with higher similarity on top), however, I do not want the rank column to be shown.
Something like this, but without showing the Rank column.
Some base regular example:
library(shiny)
library(DT)
js <- c(
" var fsrco = $('#fuzzy-ranking').DataTable({",
" fuzzySearch: {",
" rankColumn: 3",
" },",
" sort: [[3, 'desc']]",
"});",
"fsrco.on('draw', function(){",
" fsrco.order([3, 'desc']);",
"});"
)
ui <- fluidPage(
DTOutput("table")
)
server <- function(input, output, session){
output[["table"]] <- renderDT({
datatable(
iris,
selection = "none",
editable = TRUE,
callback = JS(js),
extensions = "KeyTable",
options = list(
keys = TRUE,
url = "//cdn.datatables.net/plug-ins/1.11.3/features/fuzzySearch/dataTables.fuzzySearch.js"
)
)
})
}
shinyApp(ui, server)