Giter Club home page Giter Club logo

Comments (4)

JanRomero avatar JanRomero commented on June 9, 2024 1

I was also looking for this method today to automatically mark added rows as edited. When saving changes I collect all rows with edits and send those to the server. To include new rows I now get all rows with changes or Id 0. Maybe that makes more sense anyway, but my first instinct was to just mark a cell as edited when adding the row.

I’d like to join OP in thanking you for your work on Tabulator. A godsend!

from tabulator.

olifolkerd avatar olifolkerd commented on June 9, 2024

Hey,

Thanks for the suggestion.

I'm unsure why this would be needed. Cells get marked as edited when a super edits them. If they have not been edited then the flag should not be set. If you are programmatically changing the value of the cell then you already know you have updated it in your code.

Could you please clarify the usage case.

Cheers

Oli

from tabulator.

nmih avatar nmih commented on June 9, 2024

Sure thing Oli!

I will break down our use case in a couple ways, first as a contrived example similar to the Stackoverflow question linked (which I can see us doing in the future), as well as our current use case.

I believe this boils down to us wanting to implement a table where user edits are mixed with user-triggered programmatic actions, and we want to easily use getEditedCells to retrieve the changed cells. From the perspective of the user these are all "user" edits, but from the perspective of the developer, the edits made programmatically do not get tracked as a user edit even though it was triggered by a user.

If this is not in scope of Tabulator we will definitely shift to tracking history on our own, but it is super convenient to be able to utilize the history stack, getEditedCells, other related features of Tabulator and not have to reimplement the same functionality.

Contrived example

JSFiddle: https://jsfiddle.net/nathan_mih/04fxvz7e/

In this example, the table is user editable. It also has a button "Retrieve Machine Reading" to retrieve values from some hypothetical API and set them as the data for a certain column. This acts as a preview for the user, and following this preview of data, they could then click Save to send the data back to the server.

The screengrab below shows the log of the Save button, which simply uses table.getEditedCells() and loops over the edited cells to then hypothetically send that as a payload to update the data in a database. You can see that the programmatic change is not reflected there, which is intended default behavior as you describe. However this feature request would easily enable us to track the programmatic change as a user edit.

tabulator feature req

Our current use case

We are building an interactive table that mixes per-cell user-edits with quicker tools to make those edits. I imagine we could provide similar functionality as the contrived example above to allow users to set an entire column of data using a button or input that captures the desired data the user would like to apply to that column, then applies it as an edit to multiple cells at once.

This request comes from a workaround for a solution we implemented for #4398 -- we currently are overriding the clipboardPasteAction to use cell.setValue so clipboard changes get tracked as a user edit. With this feature, we would simply be able to add cell.setEdited and our implementation needs would be very close to complete. If that feature request is something that could be worked on, this request is not as necessary (but I still do see it being useful).

--

Thanks as always for the great library and your quick responses. Let me know if I can clarify more.

from tabulator.

nmih avatar nmih commented on June 9, 2024

FYI I decided to implement this and opened up a PR #4485

This would be really great to have, it would enable a workaround I have for #4398 as well which I will post in that thread.

from tabulator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.