or
<
div
>
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.Id);
columns.Bound(p => p.UserName);
columns.Bound(p => p.FullName);
columns.Bound(p => p.Organization).ClientTemplate(
"# if (data.Organization != null) { #" +
"#= data.Organization.Name #" +
"# } else { #" +
"#: '<
N
/A>' #" +
"# } #"
)
.Filterable(filterable => filterable.UI("orgFilterKendo"));
columns.Bound(p => p.Email);
columns.Bound(p => p.PhoneNumber);
columns.Bound(p => p.PostName);
})
.Filterable(filterable => filterable
.Extra(true)
)
.EnableCustomBinding(true)
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => {
model.Id(p => p.Id);
model.Field(p => p.Id).Editable(false);
})
.Read("GetGridData", "User")
)
)
</
div
>
<
script
id
=
"orgFilterKendo"
type
=
"text/x-kendo-template"
>
@Html.Kendo().DropDownListFor(
@(Html.Kendo().DropDownList()
.Name("Organization")
.DataValueField("Id")
.DataTextField("Name")
.OptionLabel("Не задано")
.BindTo((System.Collections.IEnumerable)ViewData["UserOrganizations"])
.ToClientTemplate()
)
</
script
>
<
script
type
=
"text/javascript"
>
function orgFilterKendo(element) {
element.kendoDropDownList({
dataTextField: "Name",
dataValueField: "Id",
optionLabel: "--Select Value--",
dataSource: {
transport: {
read: "@Url.Action("FilterMenu_Organizations")"
}
}
});
}
</
script
>
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(g => g.id);
model.Field(g => g.id).Editable(false);
model.Field(g => g.user_id);
model.Field(g => g.group_id);
})
.Create(c => c.Url("http://localhost:808/api/UserGroup").Type(HttpVerbs.Post))
.Update(update => update.Url("http://localhost:808/api/UserGroup").Type(HttpVerbs.Put))
.Destroy(destroy => destroy.Url("http://localhost:808/api/UserGroup").Type(HttpVerbs.Delete))
)
OPTIONS http://localhost:808/api/UserGroup 405 (Method Not Allowed) jquery.min.js:2
OPTIONS http://localhost:808/api/UserGroup 405 (Method Not Allowed) jquery.min.js:2
DELETE http://localhost:808/api/UserGroup 404 (Not Found) UserGroup:1
XHR finished loading: "http://localhost:808/api/UserGroup".
columns.Command(commands =>
{
commands.Edit();
@<
text
>
@if (!item.IsStartPage)
{
commands.Destroy();
}
</
text
>;
})
columns.Command(commands =>
{
commands.Edit();
commands.Destroy(!item.IsStartPage);
})
public class ReportMonthTotals
{
public string Month { get; set; }
public int Year { get; set; }
public decimal Total { get; set; }
}
1 2013 1200.00
12 2012 1350.00
11 2012 1100.00
10 2012 1050.00
@(Html.Kendo().Chart<
Reporting.Data.SalesModel.ReportMonthTotals
>()
.Name("salesChart")
.Title("Sales")
.Legend(legend => legend
.Position(ChartLegendPosition.Bottom)
)
.Series(series =>
{
series.Line(m => m.Total);
})
.ValueAxis(axis => axis.Numeric()
.Labels(labels => labels
.Format("${0}")
)
)
.CategoryAxis(axis => axis
.Categories(m => m.Month)
)
.DataSource(dataSource => dataSource
.Read(read => read.Action("Sales_Read", "Sales")
.Group(group => group.Add(m => m.Year))
)
)
public ActionResult Sales_Read([DataSourceRequest] DataSourceRequest request)
{
return Json(SalesModel.GetSales(), JsonRequestBehavior.AllowGet);
}