Skip to content
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

Loading Pivot Configuration results in - Cannot read property 'value' of undefined (val = totalAggregator.value();) #70

Open
DanEnglishby opened this issue Dec 19, 2019 · 2 comments

Comments

@DanEnglishby
Copy link

After saving the pivot configuration with any of the SubTotal.js renderers to cookie and trying to restore an error is produced.

Specifically line 567 in subtotal.js (val = totalAggregator.value();)
error message: Cannot read property 'value' of undefined

The following JSON is what is being saved and attempting to be reloaded.

{"rendererOptions":{"localeStrings":{"renderError":"An error occurred rendering the PivotTable results.","computeError":"An error occurred computing the PivotTable results.","uiRenderError":"An error occurred rendering the PivotTable UI.","selectAll":"Select All","selectNone":"Select None","tooMany":"(too many to list)","filterResults":"Filter values","apply":"Apply","cancel":"Cancel","totals":"Totals","vs":"vs","by":"by"},"table":{}},"localeStrings":{"renderError":"An error occurred rendering the PivotTable results.","computeError":"An error occurred computing the PivotTable results.","uiRenderError":"An error occurred rendering the PivotTable UI.","selectAll":"Select All","selectNone":"Select None","tooMany":"(too many to list)","filterResults":"Filter values","apply":"Apply","cancel":"Cancel","totals":"Totals","vs":"vs","by":"by"},"derivedAttributes":{},"hiddenAttributes":[],"hiddenFromAggregators":[],"hiddenFromDragDrop":[],"menuLimit":9999,"cols":[],"rows":["READY_STATUS"],"vals":[],"rowOrder":"key_a_to_z","colOrder":"key_a_to_z","exclusions":{},"inclusions":{},"unusedAttrsVertical":85,"autoSortUnusedAttrs":false,"showUI":true,"sorters":{},"rendererName":"Table With Subtotal Heatmap","inclusionsInfo":{},"aggregatorName":"Count"}

As mentioned earlier, all of the standard PivotJS renderers still save/restore perfectly, it's just the new subtotal renderers that seem to have the issue.

@stephypeter
Copy link

I am facing the same issue Cannot read property 'value' of undefined at line val = totalAggregator.value();

jacooloff added a commit to jacooloff/subtotal that referenced this issue Apr 25, 2021
Fixing "Cannot read property 'value' of undefined"
@flowerbot
Copy link

flowerbot commented May 17, 2021

made a comment re this on another thread - subtotal is using aggregate values already made by the main code, they are not currently being remade on refresh, hence they are undefined when using onrefresh - somehow subtotal has to remake a table-version of the aggregators first, then apply the subtotal styling after that...

Another issue I found is that some of my source values had decimal places, converting them to integers allowed the subtotal view to render correctly the first time.

OK think I worked out what was stopping it, I need to add the 'dataClass' back to the config object on refresh:

var dataClass = $.pivotUtilities.SubtotalPivotData;

and then later in onrefresh:

configobject["dataClass"] = dataClass;

Without that, the default dataClass was being created on refresh, which didn't have the Subtotal figures in it.

jacooloff added a commit to jacooloff/subtotal that referenced this issue Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants