We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Getting value of cell w/in onCellSave(args)

Thread ID:





132639 Sep 13,2017 02:23 PM UTC Sep 14,2017 05:23 AM UTC JavaScript 1
Tags: ejSpreadSheet
Jacob Knight
Asked On September 13, 2017 02:23 PM UTC

I have code where I use ranges to calculate min/median/max values in another table and also a total in another table w/in the spreadsheet:
i.e. this.XLEdit.updateCellValue({ rowIndex: rowIndexNum, colIndex: colIndexNum }, "=MIN(" + rangeToCalc + ")");
Above & similar lines actually trigger onCellSave(args) so I was passing args.value to local storage if it is an integer since all the calcs. aside from what I enter that run onCellSave(args) end up looking like "E6:F6" for example.
I then go to read the value in that cell like: var value = this.getAlphaRange(rowIndexNum, colIndexNum).value; but it keeps returning as undefined so I'm guessing I can't grab that value while still in onCellSave(args) until after the page loads? Is this accurate? If so do you have any suggestions for how to get those values of cells after inputting.

The scenario is we set min, max, median and then if the inputted number is > or < the value in a specific cell (which gets updated on each entry so it has to be in onCellSave(args) then the cell that was just entered will update it's color based on being less than, between two values, or greater than. Like:                     xlFormat.format({ "style": { "background-color": "#99c199", "text-align": "center" } }, this.getAlphaRange(args.rowIndex, args.colIndex));

Shanmugaraja K [Syncfusion]
Replied On September 14, 2017 05:23 AM UTC

Hi Jacob, 
Thanks for using Syncfusion products, 
We have checked your requirement, and we suggest you to pass the range to getRangeData method to get the corresponding values. Please refer the below code example, 
        $(function () { 
                cellSave: "onCellSave" 
        function onCellSave(args) { 
            var val = args.value, rng; // e.g. val is =MIN(B2:B6) 
            if (val && val.startsWith("=")) { 
                rng = val.slice(val.indexOf("(") + 1, val.indexOf(")")); // rng is B2:B6. 
                data = this.getRangeData({ range: rng, property: "value" }); // you can get the data here. 
We have demonstrated the sample in JSPlayground, please refer the below sample link and documentation link, 
Shanmugaraja K 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon