init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
41
KretaWeb/Helpers/ListViewExtensions.cs
Normal file
41
KretaWeb/Helpers/ListViewExtensions.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Kendo.Mvc.UI;
|
||||
using Kendo.Mvc.UI.Fluent;
|
||||
using Kreta.Web.Helpers.Grid;
|
||||
|
||||
namespace Kreta.Web.Helpers
|
||||
{
|
||||
public static class ListViewExtensions
|
||||
{
|
||||
public static ListViewBuilder<ListViewModel> KretaListView<ListViewModel>(this HtmlHelper helper,
|
||||
string name,
|
||||
string tagName,
|
||||
string clientTemplateId,
|
||||
ApiUrlBuilder getUrl,
|
||||
bool pageable = false,
|
||||
bool autoBind = true,
|
||||
bool serverOperation = false)
|
||||
where ListViewModel : class
|
||||
{
|
||||
var urlHelper = new UrlHelper(HttpContext.Current.Request.RequestContext);
|
||||
string url = urlHelper.HttpRouteUrl(getUrl.Route, getUrl.RouteValues);
|
||||
|
||||
ListViewBuilder<ListViewModel> listViewBuilder = helper.Kendo().ListView<ListViewModel>()
|
||||
.Name(name)
|
||||
.TagName(tagName)
|
||||
.ClientTemplateId(clientTemplateId)
|
||||
.DataSource(dataSource =>
|
||||
{
|
||||
dataSource.Read(read => read.Url(url).Type(HttpVerbs.Get));
|
||||
dataSource.ServerOperation(serverOperation);
|
||||
})
|
||||
.Pageable(x => x.Enabled(pageable))
|
||||
.AutoBind(autoBind);
|
||||
|
||||
listViewBuilder.Render();
|
||||
|
||||
return listViewBuilder;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue