Skip to content
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

Is there an Editor extension available for the DT package #28

Closed
mtseman opened this issue Mar 22, 2015 · 47 comments · Fixed by #480
Closed

Is there an Editor extension available for the DT package #28

mtseman opened this issue Mar 22, 2015 · 47 comments · Fixed by #480
Milestone

Comments

@mtseman
Copy link

@mtseman mtseman commented Mar 22, 2015

I love this package. I combined several extensions and it really helps my app look great and function.

I thought KeyTable would allow me to edit, but it just navigates and highlights.

Is there an editor extension available or coming soon.

Thanks!
Mike

@yihui
Copy link
Member

@yihui yihui commented Mar 23, 2015

I guess it is probably not coming soon, but thanks for filing the request anyway :)


Update: For any future visitors of this issue, please read #480, and you can ignore all replies below.

@mtseman
Copy link
Author

@mtseman mtseman commented Apr 13, 2015

Hi Yihui,

Just a question. If I bought the Editor from DT, would it be easy to make
it work in a shinyapp? I recall your webinar had some instructions for
creating widgets outside

I looked at their site I need client and server side code(?). As I
understand it, I saw there was downloads for javascript (client side) and
.NET or PHP (server side) (?)

What would be a good resource or recommended material would you suggest I
look into to understanding more how this works.

Thanks,
Mike

On Mon, Mar 23, 2015 at 5:01 PM, Yihui Xie notifications@github.com wrote:

I guess it is probably not coming soon, but thanks for filing the request
anyway :)


Reply to this email directly or view it on GitHub
#28 (comment).

@yihui
Copy link
Member

@yihui yihui commented Apr 13, 2015

@mtseman Sorry, I have not really played with the Editor yet, so I do not know how to answer you at the moment. I imagine we are not going to need .NET or PHP, and editing can be done through R if you use server-side processing. It should not be too difficult to implement a prototype, but I'm not sure what other features that users might want besides editing the values in cells.

@danielkrizian
Copy link

@danielkrizian danielkrizian commented Apr 15, 2015

It would be great to have Editor extension available. One use case is user input of tabular data, see one mockup here: https://github.com/danielkrizian/handsonimport, which I implemented with Handsontable. Corresponding R wrapper is https://github.com/trestletech/shinyTable or older Winston Chang's https://github.com/wch/shiny-handsontable

@jpmarindiaz
Copy link

@jpmarindiaz jpmarindiaz commented May 5, 2015

+1
@danielkrizian there is also this html widget: https://github.com/jrowen/rhandsontable
It does the trick for now, but it would be pretty cool to have the edit functionality in DT!

@yihui
Copy link
Member

@yihui yihui commented May 6, 2015

This is a built-in feature of Handsontable but not DataTables (I did not purchase the Editor extension or try it). I will have to do every bit by myself, and that is what has been holding me here. I just outlined some ideas in #64.

@shrektan
Copy link
Collaborator

@shrektan shrektan commented May 8, 2015

Hey, YiHui, I like your datatable package. I will vote for the idea to add an editor extension, since after some exploration, I didn't see any easy-to-use way to edit the table, except the editor.

Thanks for what you done, for all these R packages that riches the life~!

@ihaddad-md
Copy link

@ihaddad-md ihaddad-md commented May 28, 2015

Strong +1 :)

@maxmoro
Copy link

@maxmoro maxmoro commented Jun 3, 2015

👍 me too

yihui added a commit that referenced this issue Jul 27, 2016
yihui added a commit that referenced this issue Jul 29, 2016
yihui added a commit that referenced this issue Jul 29, 2016
yihui added a commit that referenced this issue Jul 29, 2016
@yihui
Copy link
Member

@yihui yihui commented Jul 29, 2016

I have been experimenting with this recently, and I have a working prototype now. You can double click on a cell to edit its value:

devtools::install_github('rstudio/DT')

library(shiny)
library(DT)
shinyApp(
  ui = fluidPage(
    DT::dataTableOutput('x1')
  ),
  server = function(input, output, session) {
    x = iris
    x$Date = Sys.time() + seq_len(nrow(x))
    output$x1 = DT::renderDataTable(x, selection = 'none')

    proxy = dataTableProxy('x1')

    observeEvent(input$x1_cell_edit, {
      info = input$x1_cell_edit
      str(info)
      i = info$row
      j = info$col
      v = info$value
      x[i, j] <<- DT:::coerceValue(v, x[i, j])
      replaceData(proxy, x, resetPaging = FALSE)
    })
  }
)

I want to emphasize again that this is experimental. Feedback is welcome, but there is no guarantee to ship this feature eventually (I'll definitely try).

@usmansuleman
Copy link

@usmansuleman usmansuleman commented Oct 27, 2016

Really impressive package! I have used the editor feature and it is also very nice.
Thanks.

@premadh
Copy link

@premadh premadh commented Nov 7, 2016

Great package! I would like this feature as well. I tried to load a file, edit it and save it but I am somehow not able to edit user defined files here. I managed to do that using rhandsontable but with its great features, I want to do it using DT. I have asked a question here. http://stackoverflow.com/questions/40372347/load-edit-and-download-a-csv-file-in-shiny Any help will be appreciated. Thanks!

@usmansuleman
Copy link

@usmansuleman usmansuleman commented Nov 14, 2016

Hello:I have successfully edited tables in DT with shiny using the Devon version from GitHub... please try that...Usman Suleman

@paraviz02
Copy link

@paraviz02 paraviz02 commented Nov 18, 2016

@yihui - does this package replace the current version of DT? I noticed that is 28 commits behind the master ... Will installing this pose any threat to the basic DT functionality?

I haven't tried it yet, but does this actually use the DataTables Editor plugin, or does it offer another way of editing the table's data? We have been itching to get our Editor plugin working with Shiny - it is such a great interface to edit tables' data ...

yihui added a commit that referenced this issue Nov 18, 2016
@yihui
Copy link
Member

@yihui yihui commented Nov 18, 2016

@paraviz02 I don't think this feature/editor branch will pose any threat to the basic DT functionality. It is a relatively simple change. I just rebased this branch against master.

@paraviz02
Copy link

@paraviz02 paraviz02 commented Nov 18, 2016

Great, thank you.

As far as the traditional "Editor" plugin from DataTables is concerned (we have purchased a license for this), what are your thoughts on adding this to DT?

When using outside of Shiny, the ability to select a row and then modify the contents (that may or may not be visible or even included in the actual table) in a lightbox style edit window is very nice.

@yihui
Copy link
Member

@yihui yihui commented Nov 18, 2016

I don't have a copy of the Editor plugin, so I have no idea.

@happyshows
Copy link

@happyshows happyshows commented Dec 12, 2016

@yihui this editor feature looks great. What are the milestones to make it mergeable to the master branch?

@yihui
Copy link
Member

@yihui yihui commented Dec 13, 2016

@happyshows The only thing that bothers me a bit is DT:::coerceValue. It probably works well for most cases, but I wonder if there is a better solution (I asked on SO http://stackoverflow.com/q/38641980/559676 long time ago). Other than that, I'm happy with releasing this feature.

@happyshows
Copy link

@happyshows happyshows commented Dec 13, 2016

I just read through the SO question, it seems that the only problem is with Factor type column. But take a step back, should we even allow user to manually enter a new level to a large df? If it's a small df, factors won't play much roles there, using strings values sounds good to me. My 2 cents.

@yihui
Copy link
Member

@yihui yihui commented Dec 15, 2016

@happyshows I tend to agree with you.

@yihui
Copy link
Member

@yihui yihui commented Mar 15, 2017

@earthcli Besides j + 1, you have to use rownames = FALSE in both renderDataTable() and replaceData():

devtools::install_github('rstudio/DT')

library(shiny)
library(DT)
shinyApp(
  ui = fluidPage(
    DT::dataTableOutput('x1')
  ),
  server = function(input, output, session) {
    x = iris
    x$Date = Sys.time() + seq_len(nrow(x))
    output$x1 = DT::renderDataTable(x, selection = 'none', rownames = FALSE)
    
    proxy = dataTableProxy('x1')
    
    observeEvent(input$x1_cell_edit, {
      info = input$x1_cell_edit
      str(info)
      i = info$row
      j = info$col + 1
      v = info$value
      x[i, j] <<- DT:::coerceValue(v, x[i, j])
      replaceData(proxy, x, resetPaging = FALSE, rownames = FALSE)
    })
  }
)

@earthcli
Copy link

@earthcli earthcli commented Mar 15, 2017

@yihui thanks, it works!

@zkabat
Copy link

@zkabat zkabat commented Mar 23, 2017

Hi @yihui , this looks like an amazing feature. Do you expect that being merged into master branch / CRAN soon? Thank you!

@happyshows
Copy link

@happyshows happyshows commented Mar 23, 2017

+1

@yihui
Copy link
Member

@yihui yihui commented Mar 23, 2017

Perhaps in the next couple of weeks.

@catren
Copy link

@catren catren commented Mar 30, 2017

Hallo @yihui, thank you for this incredible feature. I started using it yesterday and it almost works perfectly.
I just noticed a minor bug: if I double click on a cell the little edit-box with the current value in it pops up. If I edit the value and click out of the box, the edit-box disappears and I see my normal cell with the new value. But if I don't edit the value and click out of the box I still see the edit-box and if I douple click on a new cell, both cells will have a edit-box. Only if I edit one value all the edit-boxes disappear.
It doesn't affect the functionality, but I know for sure it will make my users insecure about which value they are changing or if they can continue with a edit-box still showing. Is there a way to fix this? It would help me a lot. Thank you!

@steveb-cirina
Copy link

@steveb-cirina steveb-cirina commented Apr 11, 2017

Editing table cells is a great feature! Thanks for adding this feature.

@tsouchlarakis
Copy link

@tsouchlarakis tsouchlarakis commented May 10, 2017

To anyone having issues with editing their table: it may be because your columns are factors. I was having an issue where I would input an edit, the table would reject it, then I would input another edit and the second edit would be rejected, but the first would actually be saved. This would even happen with integer or logical columns. Once I changed my table to not include any factors (perhaps with stringsAsFactors = FALSE) this issue was fixed.

@JillShellum
Copy link

@JillShellum JillShellum commented May 21, 2017

If aiming for perfection, Please do, "Insert New Row" and "Delete Row" as well....

@dmpe
Copy link

@dmpe dmpe commented Jun 5, 2017

Hello @yihui ,
Do you think you will have some time to take a look on this issue and if the prototype is of a good quality, then also merge & close this request ?

Would be beautiful. 💯
Thanks.

@fabiangehring
Copy link

@fabiangehring fabiangehring commented Jul 8, 2017

+1

@yihui yihui added this to the v0.3 milestone Jan 16, 2018
@rstudio rstudio deleted a comment from ihaddad-md Jan 17, 2018
yihui added a commit that referenced this issue Jan 17, 2018
@rstudio rstudio deleted a comment from ihaddad-md Jan 17, 2018
@rstudio rstudio deleted a comment from ihaddad-md Jan 17, 2018
@rstudio rstudio deleted a comment from ihaddad-md Jan 17, 2018
@yihui
Copy link
Member

@yihui yihui commented Jan 17, 2018

Hi everyone, finally I'm back on DT. Apologies for being missing for almost two years! (My excuses are here and here).

I have spent about three weeks on processing all the Github issues left behind in the two years, and also polished up the table editing feature. It is pretty much done now, and I'll appreciate it if you could test it. See #480 for all the details.

BTW, @catren your issue was also resolved in #480.

@catren
Copy link

@catren catren commented Jan 18, 2018

@yihui welcome back! Thank you for working on DT again. I really rely on this fantastic package.
Thank you especially for letting me know about fixing my issue. I tested it the last hour and it works perfect.

yihui added a commit that referenced this issue Jan 18, 2018
* make it possible to edit values in table

closes #28

* export coerceValue()

* move up the double click event, to make it possible to edit a pure static table on an HTML page without Shiny
@yihui
Copy link
Member

@yihui yihui commented Jan 18, 2018

#480 has been merged. Currently I'm hoping to make a CRAN release next week.

@alexgalda
Copy link

@alexgalda alexgalda commented May 9, 2018

What's the best workaround to edit cells on a mobile (when double-click is zoom)?

@ihaddad-md
Copy link

@ihaddad-md ihaddad-md commented May 9, 2018

@varshneyayush
Copy link

@varshneyayush varshneyayush commented Jun 28, 2018

unfortunately, its not working for me.... does anyone else also facing the problem.

@rstudio rstudio deleted a comment from ihaddad-md Jun 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet