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

Make Custom Grid summaries able to read more than column data #6214

Closed
VirtualisProject opened this issue Nov 27, 2019 · 3 comments
Closed

Comments

@VirtualisProject
Copy link

VirtualisProject commented Nov 27, 2019

Is your feature request related to a problem? Please describe.

I'm currently working on implementing a grid summaries for my igx-grid. This grid in particular grid have the following columns:

  • Total units
  • First pass count (how many of the total units that passed the test in the first run)
  • Yield (percentage value of passed units)

I want to have a summary for average yield, but I cannot simply take the average of the 'Yield' columb for the summary, because the 'Average yield' is determined by the number to total units / first pass count.

Therefore, i as a developer, i would like to be able to send in input parameters to custom grid summary's, so that i can make sure that IgxSummaryResult.summaryResult returns the correct value.

image

Describe the solution you'd like

Make grid summaries templateble in the Igx-column / igx-grid

@zdrawku
Copy link
Contributor

zdrawku commented Nov 27, 2019

Hey @VirtualisProject, all data records are accessible from each column, so you can do whatever is needed with it. Two additional optional parameters are introduced in the IgxSummaryOperand operate method.

Example:

class MySummary extends IgxNumberSummaryOperand {
    constructor() {
        super();
    }
    operate(columnData: any[], allGridData = [], fieldName?): IgxSummaryResult[] {
        const result = super.operate(allData.map(r => r[fieldName]));
        result.push({ key: 'test', label: 'Total Discounted', summaryResult: allData.filter((rec) => rec.Discontinued).length });
        return result;
    }
}

Working sample

@kdinev
Copy link
Member

kdinev commented Nov 28, 2019

Duplicate of #5754

@kdinev kdinev marked this as a duplicate of #5754 Nov 28, 2019
@zdrawku zdrawku closed this as completed Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants