@(Html.EJ().Grid<object>("FlatGrid") .Datasource((IEnumerable<object>)ViewBag.datasource) .AllowFiltering() .EnableHeaderHover() .FilterSettings(filter => { filter.FilterType(FilterType.Excel); }) .AllowPaging() .AllowResizing() .Columns(col => { col.Field("JobID").HeaderText("Order ID").TextAlign(TextAlign.Right).Width(75).Add(); col.Field("UserID").HeaderText("Customer ID").Width(80).Add(); col.Field("JobStatus").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(75).Add(); col.Field("JobCountry").HeaderText("Ship City").Width(110).Add(); }) .ClientSideEvents(eve => eve.RowSelecting("rowselecting")) )
<script type="text/javascript">
function rowselecting(args) { if (args.data["JobStatus"] != "Finished") args.cancel = true; //prevent the rowselection }
</script> |
@(Html.EJ().Grid<object>("FlatGrid") .Datasource((IEnumerable<object>)ViewBag.datasource) .AllowFiltering() .EnableHeaderHover() .FilterSettings(filter => { filter.FilterType(FilterType.Excel); }) .AllowPaging() .AllowResizing() .Columns(col => { col.Field("JobID").HeaderText("Order ID").TextAlign(TextAlign.Right).Width(75).Add(); col.Field("UserID").HeaderText("Customer ID").Width(80).Add(); col.Field("JobStatus").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(75).Add(); col.Field("JobCountry").HeaderText("Ship City").Width(110).Add(); }) .ClientSideEvents(eve => eve.RowSelecting("rowselecting")) )
<script type="text/javascript">
function rowselecting(args) { if (args.data["JobStatus"] != "Finished") args.cancel = true; //prevent the rowselection }
</script> |