1

I have a kendo ui ajax grid in my asp.net mvc project and i want to calculate the columns in the total column can anyone tell me how to do. I have 5 monday to friday(AM) columns and 5 monday tpo friday (PM) columns and there are two total columns TotalAM and TotalPm so i need this column to be calculated when a user clicks checkboxes

<%: 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()
%>
4

0 回答 0