1
如何在同一视图中拥有多个不同型号的网格。同一视图中不同型号的多个网格
我不太清楚kendo网格的工作原理。 事情是当我有一个模型的网格,网格总是让我看到视图中的东西。当我只使用一个网格时,这是我的网格。
在HTML:
@model IEnumerable<CampeonatoFutbol.Models.PartidoClub>
@(Html.Kendo().Grid(Model)
.Name("grid")
.Columns(columns =>
{
columns.Bound(c => c.ClubDesc).Title("EQUIPO").Width(220);
columns.Bound(c => c.PrtidoCodigo).Title("PJ").Width(60);
columns.Bound(c => c.GolesClub).Title("GC").Width(60);
columns.Bound(c => c.PuntosClub).Title("PUNTOS").Width(150);
})
.HtmlAttributes(new { style = "height: 300px;" })
.Scrollable()
.Reorderable(reorder => reorder.Columns(true))
.Pageable(pageable => pageable
.PageSizes(true))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
)
)
这个表格没有读法动作,但它调用了控制器的这种方法操作:
public ActionResult Campeonato()
{
return View(list); // i return a list that is showing in the grid
}
的问题是在这里,当我试图显示另一个这样的模型的另一个网格:
@(Html.Kendo().Grid<CampeonatoFutbol.Models.Player>()
.Name("gridGoleadores")
.Columns(columns =>
{
columns.Bound(c => c.NombreJugador).Title("JUGADOR").Width(220);
columns.Bound(c => c.ClubDesc).Title("EQUIPO").Width(60);
columns.Bound(c => c.GolesJugador).Title("GOLES").Width(60);
})
.HtmlAttributes(new { style = "height: 300px;" })
.Scrollable()
.Reorderable(reorder => reorder.Columns(true))
.Pageable(pageable => pageable
.PageSizes(true))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("GoleadoresCampeonato", "Campeonato"))
.PageSize(20)
)
)
这个网格有一个方法动作,它从来没有在控制器中调用。 这是有,我想在这个网格返回一个列表控制器:
public ActionResult GoleadoresCampeonato()
{
return View(anotherList);
}
我想这种方式太多,但它不工作:
public ActionResult GoleadoresCampeonato([DataSourceRequest]DataSourceRequest request)
{
return Json(anotherList.ToDataSourceResult(request));
}
只有第一个网格显示我有些东西,而我希望另一个网格向我展示一些东西。
我该如何解决此问题?