DTEdit - input.choices

I have a SQL Server instance where I can successfully edit, create new and delete records using the DTedit package: https://rpubs.com/DavidFong/DTedit.

I am unable to pass in input.choices. Normally, these choices would come in from a unique list of factors from a database table, but to reprex I simply created a simple df and added a vector of choices. No matter what I put into the input.choices you can see the list of available choices does not change.

Any suggestions on how to get a list of choices into the select list on the form (not just A and B, but A, B, C, D?


##### Create the Shiny server
server <- function(input, output, session) {
    data <- data.frame(Column1 = c(1,2,3,4,5,6), Column2 = c('A','B','B','B','A', ''))
    # edit form & delete actions which updates the database tables thru embedded call-back functions
    x <- dtedit(input, output,
                name = 'Data',
                thedata = data,
                edit.cols = c( 'Column1', 'Column2'),          
                edit.label.cols = c('Column1', 'Column2'), 
                input.types = c(Column2 = 'selectInput'),
                input.choices = list(Column2 = c("A", "B", "C", "D")),
                view.cols = names(data)

##### Create the shiny UI
ui <- fluidPage(

shinyApp(ui = ui, server = server)

thank you

Thank you for your enquiry, I'm glad you are finding DTedit useful.

Strangely, I don't seem to experience the problem you are having,
as in the attached screenshot (your example code is in the left pane).

Which version of DTedit are you using (packageVersion("DTedit"))

Great point, I'm using 1.1.0 which is probably not the most current for R 3.6.

If there's an update, for some reason I can't update it thru the IDE - doesn't show up in my package update list. Do you know of the link to get\install the update thru the console?


Yes, version 1.1.0 is pretty ancient! And definitely not supported, either by Jason Bryer (v 1.0.0) or myself (now up to v 2.2.3).

I'm afraid no versions of DTedit are on CRAN. Although I think my current releases are more-or-less CRAN-ready, it isn't really my decision...

So installing my most recent releases will require using, for example, remotes::install_github

as shown on the README.md of https://github.com/DavidPatShuiFong/DTedit

remotes::install_github("DavidPatShuiFong/DTedit@2.2.3") (the most recent release, October 2020)

remotes::install_github("DavidPatShuiFong/DTedit@develop") (the current develop branch, will become v2.2.4 'real soon now')

A little off topic but, why don you just change the name of your fork and publish to CRAN with another name, you can still acknowledge the original author, it happens in open source all the time. It is clear that maintaining the package is not a priority for Jason Bryer since he doesn't even allow issue filling and ignores all pull requests.

awesome, updating brought me out of the stone age. Everything works!

and again, nice tool and thanks for providing this to the community.

David, since you're the expert can you answer one more question?

How can I get the rows_selected from a dtedit table? DT uses the syntax input${name}_rows_selected, but this doesn't seem to work with dtedit. How is the rowname rendered?


I spoke to a developer from codementor who has been working with DTedit for quite some time and he indicated that dynamic forms (i.e. change a value in a form which changes a value in the same form) is currently not possible. This is what I was looking for, so apparently it's not possible and I'll need to find an alternative.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.