[英]Kendo UI checkbox value checked using jquery
I want to get the values of the checkboxes if true then i need to add the calculated values in the Total column my code is 我想获取复选框的值(如果为true),那么我需要在我的代码的“总计”列中添加计算出的值
<%: Html.Kendo().Grid<SSTS.Models.ServiceUsedViewModel>()
.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.ForeignKey(p => p.StudentNumber, (System.Collections.IEnumerable)ViewData["students"], "StudentNumber", "StudentNumber")
.Title("StudentNumber").Width(150);
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.TotalNumberOfDaysAM).Width(150).ClientTemplate("#= calculate() #"); ; ;//.ClientTemplate("#=CustomerNames.CustomerName#").Width(160);
columns.Bound(student => student.TotalNumberOfDaysPM).Width(150);//.ClientTemplate("#=MondaydPM#"); ; ;//.ClientTemplate("#=CustomerNames.CustomerName#").Width(160);
columns.Bound(student => student.IsMoreThanOneService).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.ServiceUseID); // Specify the property which is the unique identifier of the model
model.Field(p => p.StudentNumber).DefaultValue("");
})
.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()
%> %>
I have MondayAM/PM-FridayAm/PM checkboxes and there is TotalNumberofDaysAM/PM and i need to check how many AM/PM are checked and then add them to the totalnumber column anyone knows how to do it using jquery or javascript 我有MondayAM / PM-FridayAm / PM复选框,并且有TotalNumberofDaysAM / PM,我需要检查检查了多少AM / PM,然后将它们添加到任何人都知道如何使用jquery或javascript进行操作的totalnumber列中
You might try using jQuery :checked
selector: 您可以尝试使用jQuery :checked
选择器:
// Get reference to Grid
var grid = $("#grid").data("kendoGrid");
// Get the list of `input` that are checked
var clicked = $(":checked", grid.element);
// Display the length of the array that contains the inputs that are checked
console.log("clicked", clicked);
Example here : http://jsfiddle.net/OnaBai/JB2TD/ 此处的示例: http : //jsfiddle.net/OnaBai/JB2TD/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.