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

[Solved] footer sum is not working

2 Answers 107 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Prabhat
Top achievements
Rank 1
Prabhat asked on 04 Jul 2011, 02:53 PM
 @(Html.Telerik()
                    .Grid(Model.billsForReview)
           // .Grid(new List<CopaySolutions.Core.StatementExt>())
            .Name("MyBillSearchGrid")

            .Footer(true)
                    //.Selectable()

            .Columns(columns =>
            {

                columns.Bound(p => p.Date).Width(70);
                columns.Bound(p => p.ProviderFullName);
                columns.Bound(p => p.Amount).Width(86).Format("{0:c}")
             
                 
                

                //.Aggregate(aggregates => aggregates.Sum())
                //.ClientFooterTemplate("Total: <#= Sum #>")
                //.ClientGroupFooterTemplate("Total: <#= Sum #>");

                .Aggregate(agr => agr.Sum().ToString())
                    .ClientFooterTemplate("Total Sum: <#= $.telerik.formatString('{0:c}', Sum) #>")
                    .ClientGroupFooterTemplate("Sum: <#= $.telerik.formatString('{0:c}', Sum) #>");

                columns.Bound(p => p.PaymentDueDate);
               

                                                .EnableCustomBinding(true)
                                                            .DataBinding(dataBinding => dataBinding.Ajax().Select("_GetStatementList", "Bills", new { clientId = "All", dateRange = "Last 6 Months", markedAsPaid = false }))
                                                            .Scrollable(scrolling => scrolling.Enabled(true).Height("180px"))
                                                            .ClientEvents(events => events.OnRowSelected("onBillSelected"))
                                                        .Sortable()
                                                )





CONTROLLER:
_____________________________________________________________________________________
  [GridAction(EnableCustomBinding = true)]
        public ActionResult _GetStatementList(GridCommand command, string clientId, string dateRange, bool markedAsPaid)
        {
            GetStatementList getStatementList1 = new GetStatementList()
            {
                AccountId = this.AccountId,
                ClientId = clientId,
                ProviderId = "All",
                StatementStatusId = StatementStatus.Completed.ToString() + ","

                                        +StatementStatus.PendingReview.ToString() +","
                                        + StatementStatus.Processing.ToString() + ","
                                        + StatementStatus.Faulted.ToString() + ","
                                        + StatementStatus.PendingPayment.ToString() + ","
                                        + StatementStatus.PendingFix.ToString() ,
                MarkedAsPaid = markedAsPaid,
               
              
               SortExpression = TelerikGridHelper.GetSortExpression(command.SortDescriptors, "Date DESC"),
                             
                CurrentPageIndex = 0,
                Date = ">= " + GetRangeValues(dateRange).ToShortDateString(),
                PageSize = 1000
                
            };

            try
            {
                IPagedResult<StatementExt> statementList = getStatementList1.ExecutePagedResult();
                return View(new GridModel<StatementExt> { Data = statementList.ItemList, Total = statementList.RecordCount });
            }
            catch (Exception e)
            {
                throw;
            }
        }


Footer sum is not working Please provide Solution of THis Problem   as soon as possible.....

2 Answers, 1 is accepted

Sort by
0
John DeVight
Top achievements
Rank 1
answered on 12 Jul 2011, 02:04 PM
Hi Prabhat,

I took a look at this and found that I had the same problem until I switched to binding the grid using Ajax.  Here is a sample grid:

@model IList<TelerikMvcRazorApp.Models.Person>
@{
    ViewBag.Title = "Telerik Forums : Footer Sum Not Working";
}
 
<h2>Telerik Forums : Footer Sum Not Working</h2>
 
@(
 Html.Telerik().Grid<TelerikMvcRazorApp.Models.Person>()
        .Name("PeopleGrid")
        .Footer(true)
        .DataKeys(keys =>
        {
            keys.Add(p => p.Id);
        })
        .Columns(columns =>
        {
            columns.Bound(p => p.FirstName);
            columns.Bound(p => p.LastName);
            columns.Bound(p => p.Salary)
                .Aggregate(agr => agr.Sum())
                .ClientFooterTemplate("Total Sum: <#= $.telerik.formatString('{0:c}', Sum) #>")
                .ClientGroupFooterTemplate("Sum: <#= string.Format('{0:c}', Salary) #>"); ;
        })
        .DataBinding(binding => binding.Ajax().Select("AjaxSelect", "Home"))
        .Scrollable(scrolling => scrolling.Enabled(true).Height("180px"))
)

I've attached a sample project.  Let me know if this works out for you....

Regards,

John DeVight
0
Martin Sura
Top achievements
Rank 1
answered on 14 Jul 2011, 09:21 AM
I have same problem.

If i use sum aggreate with ajax-binding, then grid dont show any record.

My configuration : asp.net mvc3, EF 4.1 code first

  EDIT : Sum aggreate not work only with timespan data type
Tags
General Discussions
Asked by
Prabhat
Top achievements
Rank 1
Answers by
John DeVight
Top achievements
Rank 1
Martin Sura
Top achievements
Rank 1
Share this question
or