or
<script src=
"~/LibsExt/jquery-1.11.0.min.js"
></script>
<script src=
"~/LibsExt/bootstrap.min.js"
></script>
<script src=
"~/LibsExt/kendo.web.min.js"
></script>
<script src=
"~/LibsExt/kendo.aspnetmvc.min.js"
></script>
public
ActionResult Produits_Read([DataSourceRequest] DataSourceRequest request)
{
int
i = 0;
return
Json(
""
);
}
public
class
ProduitModel
{
public
int
id {
get
;
set
; }
public
string
Nom {
get
;
set
; }
public
string
urlThumb {
get
;
set
; }
public
string
urlImage {
get
;
set
; }
public
string
descCourte {
get
;
set
; }
public
IHtmlString contenu {
get
;
set
; }
public
decimal
prix {
get
;
set
; }
}
@(Html.Kendo().ListView<ProduitModel>(@Model.produits)
.Name(
"listView"
)
.TagName(
"div"
)
.ClientTemplateId(
"produitTemp"
)
.DataSource(dataSource => {
dataSource.Read(read => read.Action(
"Produits_Read"
,
"CategoriesController"
).Type(HttpVerbs.Get));
dataSource.PageSize(15);
})
.Pageable()
.BindTo((IEnumerable<ProduitModel>)ViewData[
"listView"
])
)
public
class
Switch
{
[DisplayName(
"Switch Id"
)]
public
string
SwitchId {
get
;
set
; }
}
public
class
UserConsoleViewModelsController : Controller
{
public
ActionResult FilteredSwitches_Read([DataSourceRequest]DataSourceRequest request)
{
var filteredSwitches = GetFilteredSwitches().ToDataSourceResult(request);
//3 records are here at runtime
return
Json(filteredSwitches);
}
private
IEnumerable<Switch> GetFilteredSwitches()
{
return
db.Switches.ToList();
}
}
@(Html.Kendo().Grid<Switch>()
.Name(
"grid"
)
.Columns(columns =>
{
columns.Bound(c => c.SwitchId).Width(140);
})
.HtmlAttributes(
new
{ style =
"height: 380px;"
})
.Scrollable()
.Groupable()
.Sortable()
.Pageable(pageable => pageable
.Refresh(
true
)
.PageSizes(
true
)
.ButtonCount(5))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action(
"FilteredSwitches_Read"
,
"UserConsoleViewModels"
))
)