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

How to Name different Custom Group Client Footer Names for a Grid in MVC.

3 Answers 258 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bajivali
Top achievements
Rank 1
Bajivali asked on 29 Aug 2016, 01:51 PM
How to Name different Custom Group Client Footer Names for a Grid in MVC.
   
   
   

Hi ,

I have a grid that has some aggregate values . it also contains different groups. all group amounts are added and displayed in footer as sum.

coming to the groups I have different groups .

below is code :

<div class="grid-scrollable">
   <div>
    @(Html.Kendo().Grid<ViewModels.Payment.BhFormExpenseRRViewModel>()
    .Name("BHFormPATHRRGrid")
    .Events(e => e.DataBound("dataBoundpath"))
    .Events(e => e.Save("onBhFormpathModelGridSave"))
    .Events(e => e.Edit("onBhFormpathModelGridEdit"))
    .Columns(columns =>
    {
     columns.Bound(p => p.Id).Hidden(true);
     columns.Bound(p => p.ECId).Hidden(true);
     columns.Bound(p => p.ExpenseCategory).ClientFooterTemplate("Total Payment Requested")
     .ClientGroupFooterTemplate("Total Expenses").EditorTemplateName("Decimal").Format("{0:c}");
     columns.Group(g => g.Title("Current Month Expenses")
      .Columns(a =>
     {
      a.Bound(c => c.ThisMonthPath).EditorTemplateName("Decimal").Format("{0:c}").ClientFooterTemplate("#=kendo.toString(sum,'C')#")
     .ClientGroupFooterTemplate("#=kendo.toString(sum,'C')#");
      a.Bound(c => c.ThisMonthMatch).EditorTemplateName("Decimal").Format("{0:c}").ClientFooterTemplate("#=kendo.toString(sum,'C')#")
     .ClientGroupFooterTemplate("#=kendo.toString(sum,'C')#");
      
     }));
     columns.Group(g => g.Title("Reduced Monthly Expenses")
      .Columns(a =>
     {
      a.Bound(c => c.ReduceExpensesBy).EditorTemplateName("Decimal").Format("{0:c}").ClientFooterTemplate("#=kendo.toString(sum,'C')#")
      .ClientGroupFooterTemplate("#=kendo.toString(sum,'C')#");
      a.Bound(c => c.CurrentMonthExpensesSubmitted).EditorTemplateName("Decimal").Title("AdjustedPathAmount").Format("{0:c}").ClientFooterTemplate("#=kendo.toString(sum,'C')#")
      .ClientGroupFooterTemplate("#=kendo.toString(sum,'C')#");
     }));
     columns.Group(g => g.Title("Prior Month Expenses")
      .Columns(a =>
     {
      a.Bound(c => c.PriorMonthMatch).Format("{0:c}").ClientFooterTemplate("#=kendo.toString(sum,'C')#")
     .ClientGroupFooterTemplate("#=kendo.toString(sum,'C')#");
      a.Bound(c => c.PriorMonthPath).Format("{0:c}").ClientFooterTemplate("#=kendo.toString(sum,'C')#")
     .ClientGroupFooterTemplate("#=kendo.toString(sum,'C')#");
     }));
     columns.Group(g => g.Title("Cumulative Expenses YTD")
      .Columns(a =>
     {
      a.Bound(c => c.YtdMonthMatch).Format("{0:c}").ClientFooterTemplate("#=kendo.toString(sum,'C')#")
     .ClientGroupFooterTemplate("#=kendo.toString(sum,'C')#");
      a.Bound(c => c.YtdMonthPath).Format("{0:c}").ClientFooterTemplate("#=kendo.toString(sum,'C')#")
     .ClientGroupFooterTemplate("#=kendo.toString(sum,'C')#");
     }));
     columns.Command(command =>
     {
      command.Edit().HtmlAttributes(new { @class = "btn-primary k-grid-edit" });
     }).Width(200);
    })
    .Editable(editable => editable.Mode(Kendo.Mvc.UI.GridEditMode.InLine))
    .Pageable(pageable => pageable.Refresh(true).PageSizes(true).ButtonCount(5))
    .Sortable()
    .Filterable(f => f.Operators(o => o.ForString(s => s.Clear()
     .Contains("Contains")
     .DoesNotContain("Does not contain")
     .IsEqualTo("Is equal to")
     .IsNotEqualTo("Is not equal to")
     .StartsWith("Starts with")
     .EndsWith("Ends with "))))
    .Selectable()
    .Resizable(resize => resize.Columns(true))
    .DataSource(dataSource => dataSource.Ajax().PageSize(20).Model(model => model.Id(p => p.ECId)).Model(model => model.Field(p => p.TotalProirExpensesBilled).Editable(false)).Model(model => model.Field(p => p.CurrentMonthExpensesSubmitted).Editable(false)).Model(model => model.Field(p => p.TotalExpensesYtd).Editable(false)).Model(model => model.Field(p => p.ExpenseCategory).Editable(false))
    .Model(model => model.Field(p => p.PriorMonthMatch).Editable(false)).Model(model => model.Field(p => p.PriorMonthPath).Editable(false)).Model(model => model.Field(p => p.YtdMonthMatch).Editable(false)).Model(model => model.Field(p => p.YtdMonthPath).Editable(false))
    .Aggregates(aggregates =>
    {
     aggregates.Add(p => p.ThisMonthMatch).Sum();
     aggregates.Add(p => p.ThisMonthPath).Sum();
     aggregates.Add(p => p.PriorMonthMatch).Sum();
     aggregates.Add(p => p.PriorMonthPath).Sum();
     aggregates.Add(p => p.YtdMonthMatch).Sum();
     aggregates.Add(p => p.YtdMonthPath).Sum();
     aggregates.Add(p => p.ReduceExpensesBy).Sum();
     aggregates.Add(p => p.CurrentMonthExpensesSubmitted).Sum();
    })
    .Update(update => update.Action("EditBHFormRR", "ReimbursementRequestProvider").Data("additionalInfoPath"))
    .Events(events => events.Error("errorpath"))
    .Group(groups => groups.Add(p => p.ExpenseTypeId))
    .Read(read => read.Action("BHFromExpenseGridRead", "ReimbursementRequestProvider", new { bhFormName = Model.BHFormsName, reimbursementEbsId = Model.ReimbursementEbsId, prrId = Model.PrrId, rrState = @ViewBag.RRStateRequest, serviceMonth = Model.ServiceMonth }))
    )
    )
   </div>
  </div>

 

 

now my requirement is to

change group client footer of group 1 to "Total Payment Requested"
change group clientfooter of group 2 to "Total Match Claimed"
TOTAL OF TOTAL AS "Total Billing Submitted" instead of  ""


3 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 01 Sep 2016, 07:02 AM
Hi Bajivali,

You can try to add the text here:
.ClientGroupFooterTemplate("Total Payment Requested: #=kendo.toString(sum,'C')#");

Alternatively, you can traverse the group footer elements using jQuery and set the desired text.

I hope this will prove helpful.

Regards,
Eyup
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Bajivali
Top achievements
Rank 1
answered on 01 Sep 2016, 03:18 PM

.ClientGroupFooterTemplate("Total Payment Requested: #=kendo.toString(sum,'C')#");

 

this will change the name to Total Payment Requested completely.

but i want to give this name for a particular group and other group should have name like "Total Match Claimed"

 

how can i achieve this. do you a sample demo code for doing this?

0
Eyup
Telerik team
answered on 06 Sep 2016, 02:19 PM
Hi Bajivali,

This requirement cannot be achieved out of the box, because the footer template does not hold any information for the records individually, but keeps the calculated aggregates:
http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-columns.groupFooterTemplate

However, you can use custom approaches to implement a possible solution:
http://www.telerik.com/forums/grid-group-footer-names
http://stackoverflow.com/questions/28403288/how-to-get-group-by-column-value-in-group-footer-template-in-kendo-grid

Regards,
Eyup
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Bajivali
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Bajivali
Top achievements
Rank 1
Share this question
or