-
Notifications
You must be signed in to change notification settings - Fork 823
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
Ability to programmatically mark cell as edited #4443
Comments
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 |
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 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, Contrived exampleJSFiddle: 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 Our current use caseWe 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 -- Thanks as always for the great library and your quick responses. Let me know if I can clarify more. |
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! |
I'm facing the same issue and I'd like to connect to this and mark the topic a bug straight up. It should be normal if you call a setValue on a cell object from code then logic sets its flag to "edited" instantly and automatically. Imo there is no need for additional wrapper code call to set it manually afterwards. A value change is a value change. If For temporary solution @nmih 's PR would do great, otherwise in all my previous table implementations code setValues triggered an "edited" flag set. |
@mormitech thanks for your additional feedback. This is very much a new feature, a bug is when something does not operate inline with the documentation, which this feature very much does. It is on the to-do list and will be considered for a future update Cheers Oli |
@olifolkerd Got it, thanks. Alternative suggestion: introduce a "changed" flag next to the "edited". When setValue called from code: "changed" flag is set to true, when user interaction changes the cell's value: "edited" is set to true. |
I also have stumbled upon this use case. Any updates ? |
Waiting for the new feature. Currently cell.setValue() not trigger cellEdited. |
+1 from me, i also need this functionality! Im hoping the MR will get merged |
Is your feature request related to a problem? Please describe.
Developers have the ability to clear a cell as edited (https://tabulator.info/docs/6.0/edit#history). However, we do not have the ability to do the opposite and mark something as edited. A similar question was raised in this Stackoverflow link.
Describe the solution you'd like
cell.setEdited()
orcell.markEdited()
to mirrorcell.clearEdited()
table.setCellEdited([cell1, cell2])
to mirrortable.clearCellEdited([cell1, cell2])
Describe alternatives you've considered
Tracking programmatic cell updates (not made by the user, but rather the code) in a custom history stack seems to be the only way around this. We are also attempting to inject the programmatically edited cells into the Tabulator stack of editedCells.
Additional context
We would like our users to be able to preview a change that was made programmatically to be able to then save that change. We currently use
table.getEditedCells()
but this does not return cells that were changed programmatically. Adding this function would enable this functionality.The text was updated successfully, but these errors were encountered: