2016-09-08 3 views
2

私はKendoGridのための私の次のコードがあります。剣道グループフッタのテンプルネームの名前をカスタマイズする方法は?

<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 Billing Submitted") 
        .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> 

を私は私のグループフッターの名前を定義しています

.ClientGroupFooterTemplate("Total Expenses") 

これに代えて、私は別のフッター名でそれぞれ別のグループに名前を付けたいです。

誰でもこれを達成するのに手伝ってください。

  1. グループ2 = DEF

答えて

2

のグループ1 = ABC

  • フッター名のフッター名、私は正確に最終目的が何であるかを理解していない: 私の結果はこのようなものでなければなりません。値を集計するフッターと、グループごとに1つのフッターが必要ですか?私が剣道フォーラムから見たものからこれが可能かどうかはわかりません。あなたはそれに近いものを表示できるように、それはあなたのケースを助けることができる場合は、3例

    1.

       columns.Group(g => g.Title("Current Month Expenses") 
           .Columns(a => 
           { 
            a.Bound(c => c.Value).Width(200) 
             .ClientFooterTemplate("abs<div class = text-center>abC#=kendo.toString(sum,'C')#</div>"); 
            a.Bound(c => c.ValueAdvance).Width(200) 
             .ClientFooterTemplate("def<div class = text-center>#=kendo.toString(sum,'C')#</div>"); 
           })); 
    

    Type of Group Title

    2.

       columns.Group(g => g.Title("Current Month Expenses") 
           .Columns(a => 
           { 
            a.Bound(c => c.Value).Width(200) 
             .ClientFooterTemplate("<div>abs</div><hr><div class = text-center>abC#=kendo.toString(sum,'C')#</div>"); 
            a.Bound(c => c.ValueAdvance).Width(200) 
             .ClientFooterTemplate("<div>&nbsp;</div><hr><div class = text-center>#=kendo.toString(sum,'C')#</div>"); 
           })); 
    

    enter image description hereの下に使用することができます

       columns.Group(g => g.Title("Current Month Expenses") 
           .Columns(a => 
           { 
            a.Bound(c => c.Value).Width(200) 
             .ClientFooterTemplate("<div class=text-center>abs</div><div class = text-center>abC#=kendo.toString(sum,'C')#</div>"); 
            a.Bound(c => c.ValueAdvance).Width(200) 
             .ClientFooterTemplate("<div class=text-center>abs</div><div class = text-center>#=kendo.toString(sum,'C')#</div>"); 
           })); 
    

    enter image description here

    しかし、私はもっと良いものが一緒に来ていない場合は、それが役に立てば幸い、後者の場合は、おそらくあなたが望むものに近いようだと私はそれが最善の解決策ではありません理解しています。

  • 関連する問題