jthomasmock / gtExtras

A Collection of Helper Functions for the gt Package.
https://jthomasmock.github.io/gtExtras/
Other
193 stars 26 forks source link

Enhancement - Ability to embed shiny inputs within gt tables #8

Closed sactyr closed 2 years ago

sactyr commented 2 years ago

Hi Thomas,

Thank you for the great package - I have a suggestion for your package (I did ask this on the gt repo months ago but received no reply)

Would it be possible to embed shiny inputs (actionButton, selectInput, checkbox etc) within gt tables? Currently the only way this can be done is by using datatables and javascript as per the links below:

https://thatdatatho.com/adding-action-buttons-in-rows-of-dt-data-table-in-r-shiny/ https://antoineguillot.wordpress.com/2017/03/01/three-r-shiny-tricks-to-make-your-shiny-app-shines-33-buttons-to-delete-edit-and-compare-datatable-rows/ https://community.rstudio.com/t/how-to-use-shiny-action-button-in-datatable-through-shiny-module/39998/2

Use cases/benefits - this will allow shiny users to select rows in the table by using checkboxes, or to categorise rows of data by using selectInputs, or by using actionButtons one can delete that row or using textInput to add comments to particular row of data. This will open up a whole new world in shiny/table interactivity. Another use case is a gt table kanban board - in conjunction with your inline bullet charts, the bullets could represent progress time towards a deadline and another column with an action button to determine if the task is completed and if not postpone.

Cheers

jthomasmock commented 2 years ago

Hi @sactyr - thanks for the interest!

Unfortunately, I don't know enough javascript to implement something like this or maintain it long term. While I may be able to hack something together based on those resources, I wouldn't be able to maintain the feature long-term if changes were needed.