@(Html.EJ().Grid<AfroditeProPortal.DBModels.Centro>("Grid") .Datasource(ds => ds.URL(@Url.Action("DataSource")).Adaptor(AdaptorType.UrlAdaptor)) .Locale("it-IT") .AllowSorting() .AllowPaging() .PageSettings(page => page.PageSize(15)) .IsResponsive() .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); }) .ToolbarSettings(toolbar => { toolbar.ShowToolbar().ToolbarItems(items => { items.AddTool(ToolBarItems.Add); items.AddTool(ToolBarItems.Edit); items.AddTool(ToolBarItems.Delete); }); }) .Columns(col => { col.Field(c => c.IDcentro).HeaderText("IDcentro").IsPrimaryKey(true).Width("15%").Add(); col.Field(c => c.denominazione).HeaderText("Denominazione").Width("30%").Add(); col.Field(c => c.indirizzo).HeaderText("Indirizzo").Width("35%").Add(); col.Field(c => c.versioneSW).HeaderText("Ultimo collegamento").Width("20%").Add(); }) .ClientSideEvents(eve => { eve.ActionBegin("GridActionBegin"); eve.BeginEdit("GridBeginEdit"); eve.RecordDoubleClick("GridRecordDoubleClick"); }))
function GridActionBegin(args) { //pass external filter args.model.query.addParams("where", $('form').serialize()); }function GridBeginEdit(args) { //toolbar event (edit) edit(args.rowData.IDcentro); args.cancel = true; //cancel to prevent edit inline } function GridRecordDoubleClick(args) { //double click event (view) viewDetail(args.data.IDcentro);}function edit(ID) { window.location.rel='nofollow' href = 'Centri/Edit?IDcentro=' + ID; } function viewDetail(ID) { window.location.rel='nofollow' href = 'Centri/Details?IDcentro='+ ID; }
@(Html.EJ().Grid<OrdersView>("Editing")
--------------
.EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().AllowEditOnDblClick(false); })
.ToolbarSettings(toolbar =>
{
toolbar.ShowToolbar().ToolbarItems(items =>
{
items.AddTool(ToolBarItems.Add);
items.AddTool(ToolBarItems.Edit);
items.AddTool(ToolBarItems.Delete);
items.AddTool(ToolBarItems.Update);
items.AddTool(ToolBarItems.Cancel);
});
})
.Columns(col =>
{
------------
})
)
|