Closed MartinDawson closed 3 years ago
That is not the way to go. Those are only for caching purposes and can be disabled if you start your table with cache: false.
The method getValue('A1') will return the value for you. You can also access the raw data using
instance.options.data[y][x] (this is your raw information).
I am not sure what you are trying to achieve, if you give more details I am happy to help.
@hodeware Thanks for the quick response.
I have seen that but it does not give the results, it gives the formulas. E.g.
instance.getValue("B3")
That gives:
"=B4/B2"
Whereas I am wanting to access all of the calculated results for each cell, for example the above formula result is a number like: 40000
. The same way as in that screenshot above.
instance.getData() or instance.options.data
returns an array of arrays but it's the formulas results, not the calculated values which is what I want.
The reason I am wanting the calculated result for each cell is because I am doing further calculations on them outside of the spreadsheet in a different component.
You can use instance.getValue('B3', true); // the second argument is processedValue: true
But you can also get the formulas in the raw array, which will be instance.options.data[y][x] // Do not write back values on this one.
@hodeware Thanks but that's still not what I'm after.
So there's 3 levels:
The processed value is with the mask included. instance.getValue('B3', true);
gives the processed value, it does not give the processed raw value.
I need to access the processed raw values like in the cached object. There is currently no way or function to do this.
Also, as a side note it would still be better to have a property that has ALL of these values in it like in my original post above because it would be O(n) speed.
If I have to do something like instance.getProcessedRawValue
on every single node then it's very slow.
If it's still not clear I will make a jsfiddle if you want.
If you need access to the raw data, you can get using: instance.options.data[y][x]
// If you need to convert A1 in x, y jspreadsheet.helpers.getCoordsFromColumnName('A1');
Regards
Okay I tried that, it gives the formula value and not the result of that formula. Not the same as the actual raw value result in integer format which is what I was after
Anyway... I can work around it so it's not a huge issue. It would have been just a nice to have.
Sorry, looking again at your comments. There is not raw processed, in JSS you have only two results. The raw given and the final results. In your case, you need to get the result and sanitize it.
So currently an instance of jspreadsheet gives back an object with all of the functions and properties on it but it also gives back the cells key/value such as A1, A2, B1 etc etc.
See screenshot:
I need to get access these cell/values result to do other calculations and save them and more.
Currently I have to loop through
options.cells
and map where the key matches the instance property, like so:This is inefficient if I have tons of them because I have to loop through them all. It also pollutes the instance and makes it a lot bigger and hard to check the methods/properties with these cells being on the top level.
Could a new property be created, something like
cellValues
and all the top level cell values put on this property instead?This would solve this minor issue.
It would be a breaking change though.