Aspoe.Cell GridJs SpreadSheet Update after button click

I am using the Apose.Cell GridJs Spreadsheet control.
I am looking for a way to change the behavior of updating values entered in the cells.

I would like to change the moment when the values entered in the spreadsheet are saved. I noticed that currently, the values are saved when the selected cell is changed. Only then is a call made to the server using the address specified in the updateUrl property.
I would like to add a button to my application that will trigger saving when clicked. This would be similar to the current behavior when the selected cell is changed.
The idea is to prevent a situation where the user enters changes in a cell and then clicks the “save and exit” button in my application. In the current situation, the control does not save the entered data if the user has not changed the selected cell after entering the data.

@klepprime01

To change the behavior of saving values in the Aspose.Cells GridJs Spreadsheet control, you can implement a custom button that triggers the saving process when clicked. By default, the control saves the entered values when the selected cell changes, which may not be ideal for your use case.

Here’s a general approach to achieve this:

  1. Create a Button: Add a button to your application that will handle the save action.

  2. Implement Save Logic: In the button’s click event handler, you can programmatically trigger the save operation. This can be done by calling the appropriate method to update the server with the current cell values.

  3. Use the Update Function: You may need to utilize the updateCellServer function or a similar method that is responsible for sending the updated values to the server. This function should be called when the button is clicked.

Here is a simple example of how you might implement this:

// Assuming you have a GridJS Spreadsheet instance
const spreadsheet = new GridJS.Spreadsheet({
    // your configuration
});

// Add a button to your HTML
const saveButton = document.getElementById('saveButton');
saveButton.addEventListener('click', function() {
    // Call the function to update the server with current cell values
    spreadsheet.updateCellServer();
});

This way, when the user clicks the “Save” button, the current values in the spreadsheet will be sent to the server, ensuring that no data is lost if the user does not change the selected cell after entering data.

Make sure to check the documentation or the source code for any specific methods or configurations that may be required for your implementation. This approach should help you manage the saving of data more effectively in your application.

It seems that this response refers to an incorrect version of the control. I am using the JavaScript version with an API in ASP.NET, and the provided response seems to be in TypeScript. I am using the version available at:
Aspose.Cells.GridJs|Documentation
and demo example:
Aspose.Cells-for-.NET/Examples_GridJs at master · aspose-cells/Aspose.Cells-for-.NET · GitHub

Could you personalize the response according to this version?

@klepprime01,

Thanks for providing further details.

We need to evaluate your requirements and may devise code segment or provide fix for your requirements. We have opened the following new ticket(s) in our internal issue tracking system and will either provide code snippet or deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSGRIDJS-1322

Once we have an update on it, we will let you know.

@klepprime01
We now add finishEdit API for this scenario.
Please update to the latest v24.10.1 client
or use:

 <link rel="stylesheet" href="https://unpkg.com/gridjs-spreadsheet@24.10.1/xspreadsheet.css">
    <script src="https://unpkg.com/gridjs-spreadsheet@24.10.1/xspreadsheet.js"></script> 

then in your button click event you can call:

//assume xs is the gridjs client instance
xs.sheet.finishEdit()

@jakasspeech6,

Please refer to the reply posted by @peter.zhou to cope with the issue. Let us know if you still have any queries or comments.