This is a migrated thread and some comments may be shown as answers.

[Solved] ClientFooterTemplate slow on empty Grid

1 Answer 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Lee
Top achievements
Rank 1
Lee asked on 20 Jul 2011, 11:02 AM
I have a Grid using ClientFooterTemplate which works fine when there are rows, however on an empty Grid it takes forever to display the totals.  In fact after 5 minutes I just give up and it never displays ClientFooterTemplate.

@(Html.Telerik().Grid<GRID.ViewModels.FrozenFoodsRiskViewModel>()
     .Name("risksGrid")
     .ClientEvents(events => events.OnEdit("onEdit"))
     .Editable(editing => editing.Mode(GridEditMode.PopUp))
     .Sortable()
     .Filterable()
     .DataKeys(keys => keys.Add(r => r.RiskID))
     .ToolBar(commands => commands.Insert().ButtonType(GridButtonType.Image).HtmlAttributes(new { @title = "Add New Risk" }))
     .DataBinding(dataBinding =>
        {
            dataBinding.Ajax()
                .Select("_RisksIndex", "FrozenFoodsSection", new { policyZoneID = Model.PolicyZoneID, sectionID = Model.FrozenFoodsSectionID })
                .Update("_UpdateRisk", "FrozenFoodsSection", new { policyZoneID = Model.PolicyZoneID, sectionID = Model.FrozenFoodsSectionID })
                .Insert("_InsertRisk", "FrozenFoodsSection", new { policyZoneID = Model.PolicyZoneID, sectionID = Model.FrozenFoodsSectionID })
                .Delete("_DeleteRisk", "FrozenFoodsSection", new { policyZoneID = Model.PolicyZoneID, sectionID = Model.FrozenFoodsSectionID });
        })
     .Columns(columns =>
         {
             columns.Bound(r => r.RiskID).Hidden().ReadOnly();
             columns.Command(commands =>
                 {
                     commands.Edit().ButtonType(GridButtonType.Image).HtmlAttributes(new { @title = "Edit Risk"});
                     commands.Delete().ButtonType(GridButtonType.Image).HtmlAttributes(new { @title = "Delete Risk" });
                 }).Title("Commands").Width(110);
             columns.Bound(r => r.SumInsured).Width(100)
                 .Aggregate(aggregates => aggregates.Sum())
                 .ClientFooterTemplate("Total: <#= Sum #>");
             columns.Bound(r => r.Rate).Width(100).Format("{0:0.0000}");
             columns.Bound(r => r.Age).Width(50);
             columns.Bound(r => r.Description).Width(200);
             columns.Bound(r => r.InGuaranteePeriod).Width(100);
             columns.Bound(r => r.AgeDiscount).Width(100).Format("{0:0.0000}");
             columns.Bound(r => r.TechnicalPrice).Format("{0:0.00}").Width(100)
                 .Aggregate(aggregates => aggregates.Sum())
                 .ClientFooterTemplate("Total: <#= typeof Sum != 'undefined' ? $.telerik.formatString('{0:0.00}', Sum) : 0 #>");
         })
 )

As I say it's only an issue on an empty Grid.

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 20 Jul 2011, 12:04 PM
Hi Lee,

Unfortunately, I'm not able to recreate the described error. Could you please verify that there are not javascript errors on the page? Also you may try the build attached to this forum thread as it does address an issue with footer aggregates. If you continue to experience difficulties, please send us a small sample in which this error can be observed.

Regards,
Rosen
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Grid
Asked by
Lee
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or