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

issue with custom aggregator in PivotUi, while passing the aggregator value from another dropdown #1036

Closed
gparida1989 opened this issue Oct 31, 2018 · 7 comments

Comments

@gparida1989
Copy link

Hi,
I am passing a custom aggregator to PivotUi function.
here the custom aggregator is --
customAggregator = sum() aggregator + aggregator field name from an external parameter

first time it renders the table . But when i change the aggregator field param , it gives the below messege and renders with the last used aggregator field
Error : opts.aggregators[aggregator.val(...)] is not a function

On debugging i found that the below line causing the issue --
numInputsToProcess = (ref4 = opts.aggregatorsaggregator.val()().numInputs) != null ? ref4 : 0;

Except the first time, aggregator.val() is null for the subsequent attempts.
While the below code properly set the value ---
aggregator = $("").addClass('pvtAggregator').bind("change", function() { return refresh(); }); ref1 = opts.aggregators; for (x in ref1) { if (!hasProp.call(ref1, x)) continue; aggregator.append($("").val(x).html(x)); } Please assist at your earliest. Thanks

@gparida1989
Copy link
Author

To add to the above issue, this works perfectly with pivot() function

@nicolaskruchten
Copy link
Owner

Can you provide a runnable example like a CodePen or JSFiddle so that I can more easily help you?

@gparida1989
Copy link
Author

Thanks.
Please fins the codepen --
https://codepen.io/gparida1989/pen/VVZPNK?editors=0010#0

I tried to explain , where the custom aggregator field name is getting passed from another dropdown

@gparida1989
Copy link
Author

somehow I managed to fix it by unmounting the component each tim the dropdown value changes , but now it started giving me another console error ;)
Cannot read property '0' of undefined
_this.find('input.pvtFilter').not(':checked').each(function() {
debugger;

          var filter;
          filter = $(this).data("filter");
          if (exclusions[filter[0]] != null) {
            return exclusions[filter[0]].push(filter[1]);
          } else {
            return exclusions[filter[0]] = [filter[1]];
          }
        });

@gparida1989
Copy link
Author

this piece of block resolves the above issue too
_this.find('input.pvtFilter:checked').each(function() {
var filter;
filter = $(this).data("filter");
if (filter && exclusions[filter[0]] != null) {
if (inclusions[filter[0]] != null) {
return inclusions[filter[0]].push(filter[1]);
} else {
return inclusions[filter[0]] = [filter[1]];
}
}
});

only adding one extra null check

@gparida1989
Copy link
Author

Hi Nicolas,

I have raised a PR regarding the above issue.

update pivot.cofee(extra null check added to avoid error in case there is no filter data)
#1039 opened an hour ago by gparida1989

Could you please validate the same at your earliest.
@nicolaskruchten

Regards,

@gparida1989
Copy link
Author

Hi @nicolaskruchten ,

The issue solved by removing shadowdom.. it seems pivot table features like (dragNdrop etc) doesn't work smoothly with shadowDom enabled.

Closing the case

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

2 participants