@(Html.EJ().Grid<object>("HierarchyGrid") .Datasource(ds => ds.URL("DataSource").BatchURL("Update").Adaptor(AdaptorType.UrlAdaptor)) . . . . . .ToolbarSettings(toolbar => { . .. . . }) .Columns(col => { ,. . . . .. . col.Field("Verified1").ValidationRules(rule => rule.AddRule("customCompare1", new List<object>() { "checked" })).EditType(EditingType.Boolean).Add(); col.Field("Verified2").ValidationRules(rule => rule.AddRule("customCompare2", new List<object>() { "checked" })).EditType(EditingType.Boolean).Add(); }) ) <script> $(function () { $.validator.addMethod("customCompare1", function (value, element, params) { if (!$(element).parents("tr").find(".e-boolrowcell:eq(1)").is(":checked")) return !$(element).is(":checked")//Returns true, only if the second and and first boolean column also false }, "Either Verified1 or Verified2 will be checked"); $.validator.addMethod("customCompare2", function (value, element, params) { if (!$(element).parents("tr").find(".e-boolrowcell:eq(0)").is(":checked")) return !$(element).is(":checked")//Returns true, only if the second and and first boolean column also false }, "Either Verified1 or Verified2 will be checked"); }); </script> |
@(Html.EJ().Grid<OrdersView>("BatchEditing") .Datasource(ds => ds.URL(@Url.Action("DataSource")).BatchURL(@Url.Action("UpdateBatch")).Adaptor(AdaptorType.UrlAdaptor)) .. . . .Columns(col => { . . . . col.Field("Verified1").ValidationRules(rule => rule.AddRule("customCompare1", new List<object>() { "checked" })).EditType(EditingType.Boolean).Add(); col.Field("Verified2").ValidationRules(rule => rule.AddRule("customCompare2", new List<object>() { "checked" })).EditType(EditingType.Boolean).Add(); }) )
<script> $(function () { $.validator.addMethod("customCompare1", function (value, element, params) { if (!$(element).parents("tr").find(".e-boolrowcell:eq(1) input").is(":checked") || !$(element).is(":checked")) return true;//Returns true, only if the second and and first boolean column also false }, "Either Verified1 or Verified2 will be checked"); $.validator.addMethod("customCompare2", function (value, element, params) { if (!$(element).parents("tr").find(".e-boolrowcell:eq(0) input").is(":checked") || !$(element).is(":checked")) return true;//Returns true, only if the second and and first boolean column also false }, "Either Verified1 or Verified2 will be checked"); }); |
$(function () { $.validator.addMethod("customCompare1", function (value, element, params) { if (!$(element).parents("tr").find(".e-boolrowcell:eq(1) input").is(":checked") ^ !$(element).is(":checked")) return true;//Returns true, only if the second and and first boolean column also false }, "Either Verified1 or Verified2 will be checked"); $.validator.addMethod("customCompare2", function (value, element, params) { if (!$(element).parents("tr").find(".e-boolrowcell:eq(0) input").is(":checked") ^ !$(element).is(":checked")) return true;//Returns true, only if the second and and first boolean column also false }, "Either Verified1 or Verified2 will be checked"); |