Does React Data Grid have "Read Only Deletion" in addition to "Read Only Edit"? - ag-grid

React Data Grid has a Read Only Edit feature that allows you to turn the grid into something like a "controlled" component:
Use this if you want to manage the grid data state externally, such as in a Redux store.
It works well for edits, but I can't find a way to handle cell value deletions in a similar way. When you press Del while focusing on a table cell, the deletion seems to happen in-place. There doesn't seem to be a "cellDeletionRequest" which complements the existing "cellEditRequest".
Consider this example from the docs. Before completing an edit:
After completing it:
However, deleting a cell doesn't seem to trigger any deletion request, the cell's value is updated in-place, making it difficult to externalize the grid's state:
Is there a workaround for this apparent limitation?

Unfortunately, ag-grid doesn't seem to have a function like cellDeleteRequest
or detecting cell deletions yet. But you could use onCellValueChange to detect general events of a changing cell value including cell deletion.
Have read of Column Events for more detail about onCellValueChange
Hope this would be helpful!

Related

ag-Grid increment cell value after button click

I'm working with ag-grid I have a table that looks like the one provided HERE. In my own project, I am using an external api that will receive a real item. I need to update the Received Quantity after the done. Unfortunately, the api doesn't return anything other an a status code. So I can't do something like remove the row and a new row and this particular endpoint is also throttled heavily so I can't just refetch the list over and over to update it (which probably isn't a good idea anyway).
My plan was to just take the current value in Received Quantity and increment the cell myself. I can't seem to get it right and I just out of ideas of how I can possibly do that (I know it's probably simple by brain is just fried).
I'd really appreciate it if anything who's done this can help me out.
I ended up figuring this one out after a couple days not thinking about it. So I'll answer my own question for anyone who needs to know in the future.
I was trying to "edit" the data when I really needed to "update" it.
Essentially, every row in your grid will have a RowNode. You can access this node from the params of the row . Every is RowNode is indexed and has a setDataValue function which you can use to update entire rows or single cells. Click the update link above to reach the relevant documentation.

Smartsheet-api, Is there any way to get manually deleted row using smartsheet api or sdk call

I am deleting row from a sheet, On a sheet I have daily job which needs to recognize the deleted records, I need a way to recognize them using smartsheet api or sdk..
Thanks in advance..
I don't believe this scenario (identifying deleted rows) is explicitly supported by the API at this time. Seems like you could still use the API to achieve your goal though, with a bit more work (code) on your part.
Your code would have to get the sheet data (i.e., all sheet rows) at a regular interval and save that data somewhere -- then each time job runs, get the sheet data again and compare that data to the data you saved the previous time the job ran (to identify any rows that had been deleted).
Edit 9/26: Added Webhooks info
Note that with the approach I've described above, any rows that had been added AND deleted during the interval between job runs would not be detected. If it's important to identify each and every time a row is deleted, a better (and much more efficient) approach would be to use Webhooks. By using webhooks, your application subscribes to notifications for a specified sheet, and then would receive a callback (HTTP POST) from Smartsheet any time the sheet changes. Your application would need to inspect the information in each callback it receives to identify 'deleted row' events (eventType = deleted and objectType = row).
A simple way to do this is to add a column with a checkmark named "delete" or something similar, then with automation you can move the row to another sheet when the flag is detected, the row will be removed from the original sheet, but you will have a record of the deleted row in a different sheet that you can read or do what ever you need to do, this will also prevent deletions by mistake and you can even restore the row back if you need to. I don't think you need much code to implement this solution.

Eclipse Virtual TableViewer filtering and Sorting? [duplicate]

Our application is an RCP appliction and needs to display table of several thousands items. For this reason, we're using SWT.VIRTUAL in our TableViewer. That works pretty well except for selection.
We're having following issue :
Our TableViewer support sorting and filtering. When we use a virtual tableviewer, changing the selection does not preserve the current selected item but the row currently selected.This leads to another item being selected.
e.g: If Item 'A' present at the 5th row is selected by user and sorting is performed, then after sorting the Item at the 5th row gets selected instead of the Item 'A'.
Using a non virtual TableViewer, everything works fine.
We tried to go into debug and found out that the cache from the AbstractTableViewer.VirtualManager class seems to be up to date with the model.
Forcing the cache to be used in the AbstractTableViewer.virtualSetSelectionToWidget() can be a possible approach.
We have tried to implement a solution suggested in https://bugs.eclipse.org/bugs/show_bug.cgi?id=338696. However it didn't work.
Please suggest some pointers or alternative work around.
Thanks for the answers.
As a workaround for working with huge tables I would suggest you to take a look at the Nattable project http://www.eclipse.org/nattable/. It supports everything you need (sorting, filtering, tree structured elements, lazy loading etc.). We successfully use it in our project, where it is necessary to display hundreds of thousands elements as a tree with around 160 columns. It also has some pretty cool styling features, which can make your table more user-friendly and interactive. Hope this helps

How to prevent Kendo UI Grid from rebinding many times when updating ViewModels

When you bind to a Kendo UI Grid with MVVM, databound will fire once and all is well. If you need to update that data after the fact, every time you change one piece of data on any viewmodel (or child viewmodel), the entire grid re-databinds. Thus, if you had some cell in the grid that is bound to a template and you have to change 2 or 3 properties on the viewmodel from some external ajax source, Databound will fire 2 or 3 times for each model that is changed, causing the entire viewable area to rebind. How can we update lots of data at once and only have databound fire once?
How exactly you rebind the Grid? Basically if you change some of the models like this:
dataItem.set('SomeField','new value');
dataItem.set('someOtherField','other value');
This way the Grid will be indeed bound two times because of the MVVM. The change event is triggered each time you call set.
However if you update the values like this:
dataItem.SomeField='new value';
dataItem.someOtherField= 'other value';
The Grid wont react to the change and wont rebind re-read the values from the models you can force the Grid to do it through the refresh method.
$('#gridName').data().kendoGrid.refresh()
I'm not sure if there is some way to temporarily tell the grid to stop listening to events and then at the end, re-sync once. If there is, please give that answer here! Otherwise, what I did instead is I didn't go through .set() for each item. Instead, I updated the data for all the rows by setting the data directly to the property. Then when I got to the very last row I was updating, I called .set() on the last property that needed to be updated. This will cause databound to fire only once and the entire grid will refresh itself with all the data that was changed. If you don't do it this way, then the more rows displayed on the page, the longer it takes to process. (It could take 20+ seconds before the user can do anything again.)
It looks like the dataBinding event is where you can prevent a rebind on the grid.
Telerik Online Docs

Batch insertion of Rows

i read about Batch insertion and deletion of rows in the apple documentation,but didnt get a clear idea of it's use.
For example can i use it to add a few rows(animated) when the user taps on a row in the table,like a drop down list??Can somebody explain it to me or give a reference as to where i can find a tutorial??
It was pretty easy,Figured this one out on my own.All that i had to to do was modify the array from which the cells got their content,just before inserting the rows as explained in Apple's documentation.'reloadData' takes care of the rest.
One thing to note is that the logic for setting the cells content should see to it that whenever reload data is called, the cells get correct contents from the array.