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

Blazor Custom Summary Template samples: summary result is null, various other issues - clarify whether templates should be defined in JS instead #936

Open
ddaribo opened this issue Feb 12, 2025 · 1 comment
Assignees
Labels
bug: in-product issues caused by IG product bug: in-sample sample isn't working

Comments

@ddaribo
Copy link
Contributor

ddaribo commented Feb 12, 2025

In this demo, it can be seen that, although the custom summary template is rendered correctly, the summary result (Result) is null, so it is not displayed.

Image

The template is defined in razor like:

    public RenderFragment<IgbSummaryTemplateContext> WebGridOrderDateSummaryTemplate = (ctx) => {
        var summaryResults = ctx.Implicit;
        return @<div class="summary-temp">
            <span><strong>@(summaryResults[0].Label)</strong><span>@(summaryResults[0].Result)</span></span>
            <span><strong>@(summaryResults[1].Label)</strong><span>@(summaryResults[1].Result)</span></span>
        </div>;
    };

If the sample is changed to define the custom template in JS, as by the way the topic text describes, the summary result is rendered correctly:

igRegisterScript("OrderDateSummaryTemplate", (ctx) => {
    var html = window.igTemplating.html;
    var summaryResults = ctx.implicit;
    return html`<div class="summary-temp">
            <span><strong>${summaryResults[0].label}</strong><span>${summaryResults[0].summaryResult}</span></span>
            <span><strong>${summaryResults[1].label}</strong><span>${summaryResults[1].summaryResult }</span></span>
        </div>`
}, false);

<IgbColumn Field="OrderDate" SummaryTemplateScript="OrderDateSummaryTemplate" ...></IgbColumn>

Image

Reference to the same demo in WC, Angular and React.

My question is, is the current approach in the sample expected to work? If so, then an issue for the template context and the Result property being null should be logged in the https://github.com/IgniteUI/igniteui-blazor repo.
If this is not expected to work, it can then be fixed for the samples by defining the template in JS.

For the other grids, the corresponding demo also has issue with the custom summary template: Hierarchical grid, Tree grid, where they do not match their Angular equivalent (HGrid and TreeGrid).

P.S. this custom summary template sample also has an issue with the UnitsInStock custom summary - it is defined in Razor, however, this does not seem to work (check the code). On the other hand, the demo for custom summaries above it, defines it in JS and it is working as expected.
This is valid for the other grid summaries samples as well, one sample uses the razor approach and is not working correctly, and other is using JS and is okay.

In conclusion, the correct approach should be clarified, so that we can eventually fix the samples to use an unified and working one (in that case you can assign me), or log an issue for the library. @dkamburov @HUSSAR-mtrela

@ddaribo ddaribo added bug: in-product issues caused by IG product bug: in-sample sample isn't working labels Feb 12, 2025
@dkamburov dkamburov self-assigned this Feb 13, 2025
@dkamburov
Copy link
Contributor

@ddaribo This is a product issue, but we have similar cases elsewhere, particularly with templates, and resolving them may take some time.

In the meantime, we need to address this in the sample. For these scenarios, it's recommended to use the Script equivalent of properties/events, as it offers better performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: in-product issues caused by IG product bug: in-sample sample isn't working
Projects
None yet
Development

No branches or pull requests

3 participants