Tengo una pregunta interesante. ¿Cómo puedo obtener el efecto donde puedo seleccionar filas en un DT (DataTable) incorporado R-markdown en páginas y filtrado? Esto sería realmente útil ya que las filas seleccionadas a través del filtro, las páginas y las búsquedas en un marco de datos grande se pueden exportar fácilmente con los botones integrados a, por ejemplo, CSV. Necesito el javascript a continuación traducido a R.
Aquí está hecho en Javascript; https://datatables.net/examples/server_side/select_rows.html
Aquí está mi DT incorporado en R-markdown:
#DT table of departures with detailed filtering Customer_card_DT <- DT:: datatable(Customercard_all, #container = sketch, filter = "top", #adds filter options to each column (filter can be "top" or "bottom") class = "cell-border stripe hover order-column", #adds some basic styling to the table and reducing white-space with compact, highlight on mouseover with hover, and hightlight the column that is used for filtering with order-column #caption = "Customer Card", rownames = F, #Removing row name indexes editable = TRUE, #allows the table to be edited in the final output #colnamnes code below does nothing after adding colnames in container # colnames = c("PO reg", "Art", "Product", "QTY", "Destination", "ETA", "Days left", "Tracking", "Change in ETA", # "Type", "Containers", "Purch.value"), #changes column names in the final output extensions = c("Buttons", "KeyTable", "Select"), #adds buttons at the top of the table which allow the user to export the data selection = 'none', options = list( #Use the code below to hide all columns that are basicly default in a SPO upload. It shows up on export anyways. #columnDefs = list(list(visible=FALSE, targets=c(13,14))), pageLength = 30, autoWidth = TRUE, keys = TRUE, #For KeyTable entension which creates border of current cell and that enables excel style navigation between cells dom = 'Bfrtip', #For buttons select = list(style = 'os', items = 'row'), buttons = c('copy', 'csv', 'excel', 'pdf', 'print', I('colvis'), "selectCells", "selectRows", "selectNone"))) #adds buttons at the top of the table which allow the user to access different functionalities Customer_card_DT¡Muchas gracias de antemano!