|
[Index.cshtml]
@Html.EJS().Grid("DefaultPaging").DataSource(ds => ds.Url("/Home/UrlDatasource").Adaptor("UrlAdaptor").InsertUrl("/Home/Insert").RemoveUrl("/Home/Remove").UpdateUrl("/Home/Update")).Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").Width("120").IsPrimaryKey(true).Filter(new { type = "CheckBox" }).TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
col.Field("CustomerID").HeaderText("Customer Name").Width("170").Add();
col.Field("Freight").HeaderText("Freight").Width("120").Format("C2").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
col.Field("ShipCountry").EditType("dropdownedit").HeaderText("Ship Country").Width("150").Add();
col.HeaderText("").Template("#EXTemplate").Width("150").Add();
}).Height("400").AllowSorting().AllowPaging().Toolbar(new List<string>(){ "Search" }).AllowFiltering().FilterSettings(filter => filter.Type(Syncfusion.EJ2.Grids.FilterType.Menu)).EditSettings(edit => { edit.AllowEditing(true).AllowAdding(true).AllowDeleting(true); }).Render()
</div>
<script type="text/x-jsrender" id="EXTemplate">
<div class="rebot-btn-brand btn-group">
<button type="button" class="btn btn-xs rebot-blue radius-btn dropdown-toggle" style="width: 90px;" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="fa fa-download small"></span>Download</button>
<ul class="dropdown-menu">
<li><a rel='nofollow' href="#">action</a></li>
<li><a rel='nofollow' href="#">another action</a></li>
<li><a rel='nofollow' href="#">something else here</a></li>
<li role="separator" class="divider"></li>
<li><a rel='nofollow' href="#">separated link</a></li>
</ul>
</div>
</script>
<style>
.btn-group {
display: inline-block !important
}
.e-grid .e-rowcell:not(.e-editedbatchcell) {
opacity: initial;
}
.e-grid .e-rowcell.e-templatecell {
overflow: visible;
}
.dropdown-menu {
line-height: 1.5;
}
</style> |