Kendo Ui在网格中计算

时间:2013-11-14 06:45:38

标签: javascript jquery asp.net asp.net-mvc kendo-ui

我的asp.net mvc项目中有一个kendo ui ajax网格,我想计算总列中的列,任何人都可以告诉我该怎么做。我有5个星期一到星期五(AM)列和5个星期一tpo星期五(PM)列,总共有两列TotalAM和TotalPm所以我需要在用户单击复选框时计算此列

<%: Html.Kendo().Grid<SSTS.Models.ServiceUseViewModel>()
.Name("grid")
      .Columns(columns =>
      {
          // columns.Bound(student => student.CustomerName);
          columns.Bound(student => student.StudentNumber).Width(150); ;//.ClientTemplate("#=CustomerNames.CustomerName#").Width(160);
          columns.Bound(student => student.GivenName).Width(150); ;//.ClientTemplate("#=CustomerNames.CustomerName#").Width(160);
          columns.Bound(student => student.FirstDateOfTravel).Width(150); ;//.ClientTemplate("#=CustomerNames.CustomerName#").Width(160);
          columns.Bound(student => student.MondayAM).Width(150); ;//.ClientTemplate("#=CustomerNames.CustomerName#").Width(160);
          columns.Bound(student => student.MondayPM).Width(150); ;//.ClientTemplate("#=CustomerNames.CustomerName#").Width(160);
          columns.Bound(student => student.TuesdayAM).Width(150); ;//.ClientTemplate("#=CustomerNames.CustomerName#").Width(160);
          columns.Bound(student => student.TuesdayPM).Width(150); ;//.ClientTemplate("#=CustomerNames.CustomerName#").Width(160);
          columns.Bound(student => student.WednesdayAM).Width(150); ;//.ClientTemplate("#=CustomerNames.CustomerName#").Width(160);
          columns.Bound(student => student.WednesdayPm).Width(150); ;//.ClientTemplate("#=CustomerNames.CustomerName#").Width(160);
          columns.Bound(student => student.ThursdayAM).Width(150); ;//.ClientTemplate("#=CustomerNames.CustomerName#").Width(160);
          columns.Bound(student => student.ThursdayPM).Width(150); ;//.ClientTemplate("#=CustomerNames.CustomerName#").Width(160);
          columns.Bound(student => student.FridayAM).Width(150); ;//.ClientTemplate("#=CustomerNames.CustomerName#").Width(160);
          columns.Bound(student => student.FridayPM).Width(150); ;//.ClientTemplate("#=CustomerNames.CustomerName#").Width(160);
          columns.Bound(student => student.TotalDaysAM).Width(150); ;//.ClientTemplate("#=CustomerNames.CustomerName#").Width(160);
          columns.Bound(student => student.TotalDaysPM).Width(150).ClientTemplate("#=calculateField(data)#"); ; ;//.ClientTemplate("#=CustomerNames.CustomerName#").Width(160);
          columns.Bound(student => student.IsMoreThanOnceService).Width(150); ;//.ClientTemplate("#=CustomerNames.CustomerName#").Width(160);



            columns.Command(commands =>
          {
              commands.Edit(); // The "edit" command will edit and update data items
              commands.Destroy(); // The "destroy" command removes data items
          }).Title("Commands").Width(150);
      })
      .ToolBar(toolbar => toolbar.Create()) // The "create" command adds new data items
      .Editable(editable => editable.Mode(GridEditMode.InLine)) // Use inline editing mode
      .DataSource(dataSource =>
          dataSource.Ajax()
            .Model(model =>
            {
                model.Id(student => student.StudentNumber); // Specify the property which is the unique identifier of the model
            //    model.Field(student => student.StudentNumber).Editable(false); // Make the studentID property not editable

          //      model.Field(p => p.CustomerNames).DefaultValue(
           //         ViewData["defaultCategory"] as KendoGridAjaxEditing2.Models.CustomerNamesViewModel);


            })
                        .Create(create => create.Action("serviceUse_Create", "ServiceUse")) // Action invoked when the user saves a new data item
                            .Read(read => read.Action("serviceUse_Read", "ServiceUse"))  // Action invoked when the grid needs data
                            .Update(update => update.Action("serviceUse_Update", "ServiceUse"))  // Action invoked when the user saves an updated data item
                            .Destroy(destroy => destroy.Action("serviceUse_Destroy", "ServiceUse")) // Action invoked when the user removes a data item
      )
          .Pageable().Scrollable()
%>

0 个答案:

没有答案