-
Notifications
You must be signed in to change notification settings - Fork 179
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
extended editor capabilities #509
base: main
Are you sure you want to change the base?
Conversation
I extendedn the editor capabilities, so distinct columns can be marked as editable and the type of the editor can be switched between a textinput and a selectinput.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty cool, but I don't have time to review it by myself (until perhaps 6 months later). Thanks anyway!
What do you think? @shrektan
I updated my commit so the previous enabling of the editor will work. Additionally targeting the editor column is now independent from the visibility of the row names. The code for testing changed as follows:
|
It looks like a great patch, thanks, @LukasK13. I'll try to find time to review it tomorrow. |
Awesome. We should think about discarding changes made in the editor when the input loses focus. I think discading the changes may slow down the workflow, but would increase the security of not changing any values by accident but only by pressing tab or enter. |
@LukasK13 Thanks again, I think the example's effect looks very nice, especially the dropdown box to select inputs. As you said, in the long term, we want the workflow is smooth, effective and safe. So it's good to make this patch fits the future. Since Some random thinking so farIn my limited experience, I guess the editing feature is most useful when designing an CRUD interface, as discussed here. Considering this, without thinking too much about the implementation difficulties, these features will be nice:
|
That sounds amazing. |
@LukasK13 No I've never evaluated the editor of datatables but I do like its examples:
It would be good if the editing experience here is similar to the |
@shrektan The |
@LukasK13 Yes, I think your current PR is good enough. However, I'm extremely busy recently. 😢 I will take a closer look as soon as I can. |
@shrektan Ok no need to hurry, I'll see if I'll find the time to implement a date picker and the automatic detection of the input type. I would recommend using a checkbox for deletion like shown in https://datatables.net/extensions/select/examples/initialisation/checkbox.html . This would enable us activating the editor on a single click and not on a double click. |
Hey @shrektan |
@LukasK13 Being busy for a while... Well, yes, the editor of datatable looks good for me but I can't see a way of using if for free... Moreover, the JS code in the trial version I downloaded gets obfuscated so we may not be able to borrow the ideas. In addition, the size scripts is about 200KB, which means it must be quite complicated to implement the full feature... I'll see if any other way to make the editing experience closer to the official editor based on your code in the weekend. |
Hi @LukasK13 @shrektan @yihui , Here is the DT editor I built that has has (almost) all features of data table editor. Here is a live shiny app demo (limited active hours): https://appforiarteam.shinyapps.io/DT_Editor_Example2/ Github code: https://github.com/jienagu/DT-Editor Let me know if this is what you all are looking for. Some features are based on Shiny such as It supports multiple data formats (numeric, character, and date). If you want to integrate the editor features into DT package, just "parameterized" the data input part to any data (line 52-64 of server.r). Welcome to discuss and let me know if you have any questions. |
Followed up with my last comment, I already parameterized the data input part using shiny modules. Repo: https://github.com/jienagu/DT_editor_shiny_module
Hopefully it is helpful. |
Finally I got some time to work on this and borrowed some of @LukasK13's great ideas (many thanks!). Please see my comment at #493 (comment). I like the select input implemented in @LukasK13's PR, but ran out of time (still have tons of other things to do). I'll revisit it in the future. The main thing I was thinking was that the options could be automatically passed to the JS side like I did for the column filters: Lines 455 to 458 in 0d1b8de
Thanks again everyone for the very helpful input and contribution! |
Has this feature implemented yet? I had retrieve the latest but wasn't able to find it. Thank you. |
@lsusatyo-gcmlp If you mean select inputs in the table, no. Currently only text inputs are supported. |
I am just wondering if there is a way to edit data table from a drop down list for factor variables ? |
This should be possible using my fork and the code examples above. However, this PR hasn't been merged yet, as my code is pretty ugly;) |
Any ETA on when this will be merged into master? @shrektan |
This fix sounds great! Can't wait to see it! My current drop-down workaround on the client side for DT is a real headache. |
|
I did it: https://laustep.github.io/stlahblog/posts/DTcallbacks.html. |
I extended the editor capabilities, so distinct columns can be marked as editable and the type of the editor can be switched between a text input and a select input.
The editor is enabled by using
editable = TRUE
option for the data tables init. The additional attributeseditType
andeditAttribs
define the type of the editor and the editor attributes. They are set up as follows:The names in the list specify the target column, "text" specifies a text input and "select" specifies a select input. Currently, the only available option for a text input is the placeholder and for a select input the selectable options.
Furthermore the editor now offers reactivity to the keys enter, escape and tab.
Hopefully, this commit fixes #493
For testing is used the following code:
PS: Please excuse my bad javascript, I'm both new to GitHub and javascript.