Hi everyone.
I have question
I created four grids on one page.
And I have controller with four actions
But It does not work.
Is it possible to implement this variant?
I have question
I created four grids on one page.
@(Html.Kendo().Grid<
SupplierModel
>()
.Name("SubmittedGrid")
.Columns(columns =>
{
columns.Bound(p => p.SupplierId).Title("ID");
columns.Bound(p => p.ClientName);
columns.Bound(p => p.Name).Title("Supplier");
columns.Bound(p => p.SupplierGroupName).Title("Group");
columns.Bound(p => p.ShortName);
columns.Bound(p => p.Address1);
columns.Bound(p => p.Address2);
columns.Bound(p => p.RejectReason).Title("Reason");
columns.Bound(p => p.SupplierId).Title(" ").Template(@<
text
>
@Html.ActionLink("Review", "Edit", new { supplierId = @item.SupplierId.Value })
</
text
>);
//columns.Command(command => command.Edit()).Title(" ");
})
.Pageable()
.Sortable()
.Selectable()
.DataSource(dataSource => dataSource.Server()
.PageSize(GlobalVariables.DefaultPageSize)
.Model(model =>
{
model.Id(p => p.SupplierId);
})
.Read(read => read.Action("GetNewSuppliers", "Requestor"))
.Update(update => update.Action("Edit", "Requestor"))
).Resizable(resize => resize.Columns(true))
)
@(Html.Kendo().Grid<
SupplierModel
>()
.Name("SubmittedGrid")
.Columns(columns =>
{
columns.Bound(p => p.SupplierId).Title("ID");
columns.Bound(p => p.ClientName);
columns.Bound(p => p.Name).Title("Supplier");
columns.Bound(p => p.SupplierGroupName).Title("Group");
columns.Bound(p => p.ShortName);
columns.Bound(p => p.Address1);
columns.Bound(p => p.Address2);
columns.Bound(p => p.RejectReason).Title("Reason");
columns.Bound(p => p.SupplierId).Title(" ").Template(@<
text
>
@Html.ActionLink("Review", "Edit", new { supplierId = @item.SupplierId.Value })
</
text
>);
//columns.Command(command => command.Edit()).Title(" ");
})
.Pageable()
.Sortable()
.Selectable()
.DataSource(dataSource => dataSource.Server()
.PageSize(GlobalVariables.DefaultPageSize)
.Model(model =>
{
model.Id(p => p.SupplierId);
})
.Read(read => read.Action("GetSubmittedSuppliers", "Requestor"))
.Update(update => update.Action("Edit", "Requestor"))
).Resizable(resize => resize.Columns(true))
)
@(Html.Kendo().Grid<
SupplierModel
>()
.Name("ApprovedGrid")
.Columns(columns =>
{
columns.Bound(p => p.SupplierId).Title("ID");
columns.Bound(p => p.ClientName);
columns.Bound(p => p.Name).Title("Supplier");
columns.Bound(p => p.SupplierGroupName).Title("Group");
columns.Bound(p => p.ShortName);
columns.Bound(p => p.Address1);
columns.Bound(p => p.Address2);
columns.Bound(p => p.RejectReason).Title("Reason");
//columns.Command(command => command.Edit()).Title(" ");
})
.ToolBar(toolBar =>
{
toolBar.Template(@<
text
>
<
div
class
=
"toolbar-to-right"
>
<
label
>Supplier:</
label
>
<
span
class
=
"k-textbox"
>
<
input
id
=
"supplierFilter"
/>
<
a
href
=
"#"
class
=
"k-icon k-i-search"
> </
a
>
</
span
>
</
div
>
</
text
>);
})
.Pageable()
.Sortable()
.Filterable()
.Selectable()
.DataSource(dataSource => dataSource.Server()
.PageSize(GlobalVariables.DefaultPageSize)
.Model(model =>
{
model.Id(p => p.SupplierId);
})
.Read(read => read.Action("GetApprovedSuppliers", "Requestor"))
.Update(update => update.Action("Edit", "Requestor"))
).Resizable(resize => resize.Columns(true))
)
@(Html.Kendo().Grid<
SupplierModel
>()
.Name("RejectedGrid")
.Columns(columns =>
{
columns.Bound(p => p.SupplierId).Title("ID");
columns.Bound(p => p.ClientName);
columns.Bound(p => p.Name).Title("Supplier");
columns.Bound(p => p.SupplierGroupName).Title("Group");
columns.Bound(p => p.ShortName);
columns.Bound(p => p.Address1);
columns.Bound(p => p.Address2);
columns.Bound(p => p.RejectReason).Title("Reason");
columns.Bound(p => p.SupplierId).Title(" ").Template(@<
text
>
@Html.ActionLink("View", "Edit", new { supplierId = @item.SupplierId.Value })
</
text
>);
//columns.Command(command => command.Edit()).Title(" ");
})
.Pageable()
.Sortable()
.Selectable()
.DataSource(dataSource => dataSource.Server()
.PageSize(GlobalVariables.DefaultPageSize)
.Model(model =>
{
model.Id(p => p.SupplierId);
})
.Read(read => read.Action("GetRejectedSuppliers", "Requestor"))
.Update(update => update.Action("Edit", "Requestor"))
).Resizable(resize => resize.Columns(true))
)
public
ActionResult GetNewSuppliers([DataSourceRequest] DataSourceRequest request)
{
var data = service.GetSuppliersByStatus(SupplierStatusEntity.SavedDraft).Where(s =>
string
.Equals(s.PINUserName, User.Identity.Name, StringComparison.OrdinalIgnoreCase)).Select(SupplierConverter.Convert);
return
Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
public
ActionResult GetSubmittedSuppliers([DataSourceRequest] DataSourceRequest request)
{
var data = service.GetSuppliersByStatus(SupplierStatusEntity.Submitted).Where(s => s.PINUserName == User.Identity.Name).Select(SupplierConverter.Convert);
return
Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
public
ActionResult GetApprovedSuppliers([DataSourceRequest] DataSourceRequest request)
{
var data = service.GetSuppliersByStatus(SupplierStatusEntity.Approved).Where(s =>
string
.Equals(s.PINUserName, User.Identity.Name, StringComparison.OrdinalIgnoreCase)).Select(SupplierConverter.Convert);
return
Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
public
ActionResult GetRejectedSuppliers([DataSourceRequest] DataSourceRequest request)
{
var data = service.GetSuppliersByStatus(SupplierStatusEntity.Rejected).Where(s => s.PINUserName == User.Identity.Name).Select(SupplierConverter.Convert);
return
Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
Is it possible to implement this variant?