{code}
@using System.Globalization
@using Kendo.Mvc.UI
@using Kendo.Mvc.UI.Fluent
@using My.Dashboard.Results.Domain.Entities
@model My.Dashboard.Web.Models.GraphSettingsViewModel
<
div
id
=
"weeklyResultsForSpecificYearChart-wrapper"
style
=
"width:100%"
>
@(Html.Kendo().Chart<
WeeklyResult
>()
.Name("WeeklyResultForSpecificYearChart")
.Theme("MetroBlack")
.Tooltip(new Action<
ChartTooltipBuilder
>(t => t.Visible(true).Template("#=value# #=series['name']# Results For week number #=category#")))
.Title("Weekly Results for " + Model.Year.ToString(CultureInfo.InvariantCulture))
.Legend(legend => legend.Position(ChartLegendPosition.Bottom))
.DataSource(dataSource => dataSource.Read(read => read.Action("GetAllWeeklyResultsForSpecificYear", "Result", new { year = Model.Year })))
.Series(series =>
{
series.Column(model => model.FranceResults).Name("France").Stack("All");
series.Column(model => model.NorthAmericaResults).Name("North American").Stack("All");
series.Column(model => model.ItalyResults).Name("Italy").Stack("All");
})
.CategoryAxis(axis => axis
.Categories(model => model.Week)
.Labels(labels => labels.Rotation(-90)))
.CategoryAxis(axis => axis
.Labels(model => model.Format("{0:0}"))))
</
div
>
.CategoryAxis(axis => axis.Categories(model => model.FirstMondayOfWeek)
.Labels(labels => labels.Rotation(-90)))
.CategoryAxis(axis => axis
.Labels(model => model.Format("dd"))))
.CategoryAxis(axis => axis
.Categories(model => model.Week)
.Labels(labels => labels.Rotation(-90)))
.CategoryAxis(axis => axis
.Labels(model => model.Format("{0:0}"))))
.Tooltip(new Action<
ChartTooltipBuilder
>(t => t.Visible(true).Template("#=value# #=series['name']# Results For #=FirstMondayOfWeek#")))
Hi,
Is it possible to data-bind a form submit? I know how to bind on button click but I would like to know if I can bind for form submit e.g <form data-bind='submit: handleSubmit'></form>.
Regards,
dataSource => dataSource.Ajax().Data(
"sendData"
)
dataSource => dataSource
.Ajax()
.Read(read => read.Action(
"Products_Read"
,
"Home"
)
.Data(
"additionalData"
)
// name of the client function that returns the additional data
)
We have a datepicker on an MVC view, rendered per this snippet:
@(Html.Kendo().DatePicker()
.Name(
"criteriaDate"
)
.Depth(CalendarView.Year)
.Format(Model.DateFormat)
.Max(Model.RangeEnd.DateTime)
.Min(Model.RangeStart.DateTime)
.Value(Model.RangeStart.DateTime)
.HtmlAttributes(
new
{ style =
"width:100%;"
})
)
Everything works fine when the view is rendered directly, but when another site attempts to show it in an iframe we are seeing this error in the Visual Studio debugger: Unhandled exception at line 25, column 9190 in http://localhost/site/Scripts/kendo.all.min.js, which is in the toFront function on the "s=document.activeElement" line. The result is that the datepicker control doesn't render on the page.
I didn't see anything on this topic, so any help would be appreciated. Thanks in advance...
We have recently downloaded a trial version of the Kendo UI suite with a view to making a purchase at the end of the trial. We are using the Kendo grid control in Ajax binding mode and have noticed a few problems. The main issue is that the following script error occurs when deleting the last record in the model that is bound to the grid:
Unhandled exception at line 18, column 31059 in http://**/Scripts/kendo/2012.3.1114/kendo.web.js 0x800a138f - Microsoft JScript runtime error: '_current' is null or not an object
We cannot replicate this in Chrome. We are interested in Kendo as it is marketed as being compatible with IE8. This doesn't appear to be the case.
Here is the grid in our .cshtml file:
@(Html.Kendo().Grid(Model)
.Name("UserGrid")
.HtmlAttributes(new { style = "height:500px" })
.Columns(columns =>
{
columns.Bound(p => p.ReferenceNumber).Groupable(false);
columns.Bound(p => p.Title).Title("Title");
columns.Bound(p => p.AgreementDate).Title("Agreement Date");
columns.Bound(p => p.Superseded).ClientTemplate(
"<input type='checkbox' disabled='disabled' value='#= Superseded #' " +
"# if (Superseded) { #" +
"checked='checked'" +
"# } #" +
"/>");
//columns.Bound(p => p.Parties.Count);
columns.Bound(p => p.SourceDocumentLink);
columns.Bound(p => p.RelationshipLeadDirector);
columns.Bound(p => p.Owner);
columns.Bound(p => p.LegalContact);
columns.Command(command => command.Destroy()).Width(100);
columns.Template(@<text></text>).ClientTemplate("<a class='k-button k-button-icontext k-edit-button' href='" + Url.Action("Update", "Agreement") + "/#=Id#'><span class='k-icon k-edit'></span>Edit</a>");
})
.DataSource(dataSource => dataSource
.Ajax()
//.Server()
//.Events(events => events.RequestStart("requeststart_handler"))
//.Events(events => events.Error("error_handler"))
.Model(model => model.Id(p => p.Id))
.Destroy("Delete", "Agreement")
.Update("Update","Agreement")
.Read(read => read.Action("ListAgreements", "Agreement")
))
.Navigatable()
.Scrollable()
.Resizable(s=>s.Columns(true))
.Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
.Sortable()
.Pageable(builder => builder.PageSizes(true))
)
And here is the action on our controller that takes care of a delete:
[HttpAjaxPost]
public JsonResult Delete([DataSourceRequest] DataSourceRequest request, AgreementData agreement)
{
try
{
_agreementService.DeleteAgreement(agreement);
ModelState.Clear();
}
catch (Exception ex)
{
Logger.GetLog(Logger.ServiceLog).Error(ex);
ModelState.AddModelError("errors", "Delete failed");
}
return Json(ModelState.ToDataSourceResult());
}
Is this a bug with the Kendo grid or have we missed something obvious? Just to recap..the script error only occurs when deleting the last record in the grid.