This question is locked. New answers and comments are not allowed.
Hi there,
I'm trying to use a checkbox to group and ungroup the telerik mvc grid using the client side api. It all works fine but what I want to do now is disable the checkbox while the grouping is being performed. Is there a way to control the on start and on end behaviour while the grouping is performed.
I'm trying to use a checkbox to group and ungroup the telerik mvc grid using the client side api. It all works fine but what I want to do now is disable the checkbox while the grouping is being performed. Is there a way to control the on start and on end behaviour while the grouping is performed.
| var transactionGrid; |
| var transactionGridSelector = "#transactionGrid"; |
| // click event to apply grouping |
| $("#GroupByItemConfig").click(function () { |
| if ($(this).attr("checked")) { |
| ApplyGrouping("Item Config", "asc"); |
| } |
| else { |
| ClearGrouping("Item Config"); |
| } |
| }); |
| // click event to apply grouping |
| $("#GroupByReference").click(function () { |
| if ($(this).attr("checked")) { |
| ApplyGrouping("Reference", "asc"); |
| } |
| else { |
| ClearGrouping("Reference"); |
| } |
| }); |
| function ApplyGrouping(columnName, orderBy) { |
| var transactionGrid = $(transactionGridSelector).data('tGrid'); |
| if (transactionGrid.groups.length != 0) transactionGrid.unGroup(transactionGrid.groups[0].title); |
| transactionGrid.group(columnName); |
| } |
| function ClearGrouping(columnName) { |
| var transactionGrid = $(transactionGridSelector).data('tGrid'); |
| transactionGrid.unGroup(columnName); |
| } |
| <input type="checkbox" id="GroupByItemConfig" value="Item Config" class="mutuallyexclusive" /> |
| <label for="GroupByItemConfig">Group By Item/Config</label> |
| <input type="checkbox" id="GroupByReference" value="Reference" class="mutuallyexclusive" /> |
| <label for="GroupByReference">Group By Reference</label> |
| <%= Html.Telerik().Grid<ProcessTransactionModel>() |
| .Name("transactionGrid") |
| .ClientEvents(clientevents => clientevents |
| .OnRowDataBound("onRowDataBound") |
| .OnDataBound("onDataBound")) |
| .DataBinding(dataBinding => dataBinding.Ajax().Select("AjaxUnprocessedTransactionBinding", "ProcessTransaction", new { locationCode = "" })) |
| .Columns(columns => |
| { |
| columns.Bound(o => o.Date) |
| .Sortable(false) |
| .Width("150px") |
| .Format("{0:dd/MM/yyyy hh:mm tt}"); |
| columns.Bound(o => o.ItemConfig) |
| .Width("100px"); |
| columns.Bound(o => o.Name) |
| .Sortable(false); |
| columns.Bound(o => o.Consumed) |
| .Sortable(false) |
| .Width("80px"); |
| columns.Bound(o => o.Level) |
| .Sortable(false) |
| .Width("80px"); |
| columns.Bound(o => o.Reference) |
| .Width("100px"); |
| columns.Bound(o => o.StockTransactionID) |
| .Sortable(false) |
| .Width("100px") |
| .ClientTemplate("<input type='checkbox' name='checkedRecords' onclick='GetCheckedTransactions();' class='chkAddToOrder' value='<#= StockTransactionID #>' Consumed='<#= Consumed #>' />") |
| .Title("Add To Order"); |
| columns.Bound(o => o.StockTransactionID) |
| .Width("50px") |
| .ClientTemplate("<img src='" + Url.Content("~/Content/images/delete.png") + "' style='width:13px;cursor:hand;' onclick='DeleteItem(this);' value='<#= StockTransactionID #>' class='deleteItem' StockTransactionID='<#= StockTransactionID #>' StockLevelID='<#= StockLevelID #>'/>") |
| .Sortable(false) |
| .Title("Delete"); |
| }) |
| .Scrollable() |
| .Groupable() |
| .Sortable() |
| %> |
|
|