Hello,
I have a problem with grid pager translation: pagination buttons tooltips and "items per page" label appear always in english.
I've checked the messages translation scripts are linked and working as you can see in the attached screenshot, and other regions such as grid filters are ok.
What am I doing wrong?
Thanks for helping.
We just updated to the latest Kendo version (2015.1.408.545), and the view switcher now has a box stuck to the left that shows your current view. I hope there is a way to turn this off, as it is not desirable in the least, since the selected view already appears...selected. Anybody else get this? I checked the demos site, and it's not doing it there at all, so I'm not sure what I've done to get it.
Example:
Hi,
I am trying to create sortable editable list view with
cascading dropdown list in it
I have three problems:
1.
On adding new item in
Controllers “Editing_Create” action I
receive null values for properties from drop down lists (EntityTypeId and EntityId)
2.
When I am adding sortable
behavior to the list view, in the edit item mode the text input for the “Text” model property is disabled
3.
Minor issue: the max characters
validation is not working on text input for the “Text” model property
Besides these three issues the list view rendered as
expected
Thanks,
View:
<div class="demo-section">
<a class="k-button k-button-icontext k-add-button" href="#"><span class="k-icon k-add"></span>Add new record</a>
</div>
<div class="demo-section">
@(Html.Kendo().ListView<QuickLinkViewModel>()
.Name("listView" + Model.ComponentId)
.TagName("div")
.ClientTemplateId("quickLinkTemplate")
.DataSource(dataSource => dataSource
.Model(model => model.Id("ComponentId"))
.Create(create => create.Action("Editing_Create", "QuickLink", new { parentId = Model.ComponentId }))
.Read(read => read.Action("Editing_Read", "QuickLink", new{parentId = Model.ComponentId}))
.Update(update => update.Action("Editing_Update", "QuickLink"))
.Destroy(destroy => destroy.Action("Editing_Destroy", "QuickLink"))
)
.Editable()
)
</div>
@(Html.Kendo().Sortable()
.For("#listView" + Model.ComponentId)
.Handler(".handler")
.Cursor("move")
.PlaceholderHandler("layout.footer.placeholder")
.HintHandler("layout.footer.hint")
.Events(events => events.Change("layout.footer.onChange"))
)
Editable Template:
<div class="quickLink-view
k-widget">
<input type="hidden" name="ParentId" value="#:ParentId#" />
<input type="hidden" name="SortOrder" value="#:SortOrder#" />
<span class="handler"> </span>
<span>
<input data-role="dropdownlist"
data-text-field="Text"
data-value-field="Value"
data-bind="value:
EntityTypeId"
value="#:EntityTypeId#"
data-source="layout.entityTypesData"
id="entityType#:id#"
name="EntityTypeId"
data-option-label="Select"
data-close="layout.footer.setValue"
data-val-required="*">
<span class="field-validation-valid" data-valmsg-for="entityType#:id#" data-valmsg-replace="true"></span>
</span>
<span>
<input data-role="dropdownlist"
id="entity#:id#"
name="EntityId"
data-auto-bind="false"
data-text-field="Text"
data-value-field="Value"
data-cascade-from="entityType#:id#"
data-bind="value:
EntityId"
value="#:EntityId#"
data-source="layout.entityDropDownDataSource"
data-option-label="Select"
data-close="layout.footer.setValue"
data-val-required="*" />
<span class="field-validation-valid" data-valmsg-for="entity#:id#" data-valmsg-replace="true"></span>
</span>
<span>
<input class="k-textbox"
data-val="true"
data-val-maxlength="Text
cannot be longer than 25 characters."
data-val-maxlength-max="25"
data-val-required="*"
id="text#:id#"
name="Text"
type="text"
value="#:Text#" />
<span class="field-validation-valid" data-valmsg-for="text#:id#" data-valmsg-replace="true"></span>
</span>
<div class="edit-buttons">
<a class="k-button k-update-button" href="\\#"><span class="k-icon k-update"></span></a>
<a class="k-button k-cancel-button" href="\\#"><span class="k-icon k-cancel"></span></a>
</div>
</div>
Model:
public class QuickLinkViewModel
{
public int ComponentId { get; set; }
[Required(ErrorMessage
= Errors.Required)]
public TgEntityType?
EntityTypeId { get; set; }
[Required(ErrorMessage
= Errors.Required)]
public int? EntityId { get; set; }
[Required(ErrorMessage
= Errors.Required)]
[MaxLength(25,
ErrorMessage = "Name cannot be longer
than 25 characters.")]
public string Text { get; set; }
public int SortOrder { get; set; }
public int ParentId { get; set; }
}
Create action in Controller:
[AcceptVerbs(HttpVerbs.Post)]
public async Task<ActionResult>
Editing_Create([DataSourceRequest] DataSourceRequest request, QuickLinkViewModel link, int? parentId)
{
var results = new List<QuickLinkViewModel>();
if (link != null && parentId != null &&
ModelState.IsValid)
{
link.ParentId = parentId.Value;
await Create(link);
results.Add(link);
}
return
Json(results.ToDataSourceResult(request, ModelState));
}
Thanks
I have a grid where each row has a custom command that opens a details modal. The details modal is populated with the contents of a kendo template. I want to include a kendo grid inside of that template.
Data structure is Contract (main page)->CoveredEquipment (first grid)->WearableParts (grid on modal)
My problem is that I get a javascript "invalid template" error when the page is loaded. It seems to not like
#= kendo.render(kendo.template($("\#wearablePartsGridTemplate").html()), WearableParts); #in the modal template.
What am I doing wrong?
<script id="wearablePartsGridTemplate" type="x-kendo-template"> @(Html.Kendo().Grid<FieldServiceWeb.Areas.Admin.Models.ServiceContract.WearablePartViewModel>() .Name("wearablePartsGrid") .DataSource(dataSource => dataSource.Ajax() .Model(model => model.Id(p => p.PartNumber)) .ServerOperation(false) .Update("Update", "ServiceContracts", new { area = "Admin" }) .Destroy("Delete", "ServiceContracts", new { area = "Admin" }) .Create("Create", "ServiceContracts", new { area = "Admin" }) ) .Columns(columns => { columns.Bound(c => c.PartNumber).Title("Part"); columns.Bound(c => c.Description); columns.Bound(c => c.IsActive).Title("Active"); columns.Command(c => c.Destroy().Text("Delete")); }) .ToClientTemplate())</script><script type="text/x-kendo-template" id="wearablePartsContent">
<label>Wearable parts for <strong>#: CSPId # - #: Description #</strong></label>
#= kendo.render(kendo.template($("\\#wearablePartsGridTemplate").html()), WearableParts); #
</script>
<script>
function openWearableParts(e) {
e.preventDefault();
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
$("#wearablePartsModal").find(".modal-body").html(wearablePartsTemplate(dataItem));
//createGrid();
$("#wearablePartsModal").modal("show");
}
</script>
I have a Service Contract that can have many pieces of Covered Equipment. I would like to use the grid control to let users add and edit equipment BEFORE the parent object is created (basically storing it all client-side, and then sending it back with the parent info in one form POST).
Is this scenario possible? All of the examples I've found are using AJAX calls on each edit, which I can't do.
I've got the following code which doesn't seem to render correctly, it moves the fields outside of the form, so the form is an empty tag. I tried adding .Render() to both tabstrip and window at different times and gained a .NET error
"CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments "
@(Html.Kendo().TabStrip() .Name("tabstrip") .Items(tabstrip => {@*More tabs*@ tabstrip.Add().Text("Create New Task") .Content( @<text> @using (Ajax.BeginForm(null, null, new AjaxOptions { Url = Url.Action("UserAddNewTask", "ProjectApi", new { area = "API" }), OnSuccess = "CloseAndRefreshTaskGrid()" }, new { @id = "newTaskForm" })) { @Html.Hidden("Id") <div class="container-fluid"> @*More fields*@ <div class="row top10"> @Html.Label("Task Name", new { }) @Html.Kendo().TextBoxFor(model => model.Name) @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" }) </div> <div class="row top10"> <button class="btn btn-success" id="btnNewTaskSubmit" type="submit">Submit</button> </div> </div> } </text>); }))
@(Html.Kendo().TabStrip() .Name("tabstrip") .Items(tabstrip => { tabstrip.Add().Text("Create New Task") .Content( @<text> @using (Ajax.BeginForm(null, null, new AjaxOptions { Url = Url.Action("UserAddNewTask", "ProjectApi", new { area = "API" }), OnSuccess = "CloseAndRefreshTaskGrid()" }, new { @id = "newTaskForm" })) { @Html.Hidden("Id") <div class="container-fluid"> @*More fields*@ <div class="row top10"> @Html.Label("Task Name", new { }) @Html.Kendo().TextBoxFor(model => model.Name) @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" }) </div> <div class="row top10"> <button class="btn btn-success" id="btnNewTaskSubmit" type="submit">Submit</button> </div> </div> } </text>); }))
@(Html.Kendo().Window() .Name("editTaskModal") .Modal(true) .Draggable() .Actions(a => a.Pin().Maximize().Minimize().Close()) .Title("Edit Task") .Width(800) .Visible(false) .Position(p => p.Top(150)) //.Content(@Partial/_TimesheetNewTask") .Content(@<text>@Html.Partial("Partial/_TimesheetNewTask")</text>))01.@(Html.Kendo().Window()02. .Name("editPasswordPopUp")03. .Visible(false)04. .Modal(true)05. .Width(600)06. .Height(500)07. .Position(settings =>08. settings.Top(70).Left(200))09. .Title("Edit your password")10. .Content("loading user info...")11. .LoadContentFrom("EditPassword", "Member")12. .Iframe(true)13. .Resizable()14. .Draggable()15. )1.public ActionResult EditPassword() {2. return PartialView();3.}1.[HttpPost]2.[ValidateAntiForgeryToken]3.public ActionResult EditPassword(EditPasswordViewModel viewModel)4.{5. [....]6. return RedirectToAction("Profile", "Member", new {id = viewModel.Id});7. [....]8.}01.@using Devoteam.CustomerPortal.Application.Helpers02.@model Devoteam.CustomerPortal.ViewModels.EditPasswordViewModel03.@{04. ViewBag.Title = "Edit";05. Layout = null;06.}07. 08.@Styles.Render("~/Content/css")09.@Scripts.Render("~/bundles/jquery")10.@Scripts.Render("~/bundles/jqueryval")11.@Scripts.Render("~/bundles/kendo")12. 13.@using (Html.BeginForm())14.{15. @Html.AntiForgeryToken()16. 17. <div id="messageError">18. @Html.ValidationSummary()19. </div>20. [...] // Fields21. 22. <div class="buttons">23. <input type="submit" value="Confirm" class="big-button" />24. <input type="submit" value="Cancel" class="big-button" />25. </div>26.}function deleteCommand(e) { var grid = $('#reimbursementsGrid').data('kendoGrid'); var rows = grid.select(); rows.each( function () { var record = $(this).data(); alert('Selected : ' + record.Id); } )}@(Html.Kendo().Grid(Model) .Name("reimbursementsGrid") .DataSource(dataSource => dataSource .Server() .Model(model => { model.Id(r => r.Id);
...
.Columns(columns =>
{
columns.Bound(o => o.Id).Hidden(true);
...
Picture of the chart: http://i.imgur.com/K88FEJd.png
I cannot get the chart to do categories correctly. If you look at the dates in the following data they are all different except if it is a different department. But in the picture they seem to merge for some reason. Can someone explain this?
Here is my return JSON data...
[{"DepartmentName":"Information Technology","TicketDate":"2015-04-01","TicketCt":3},{"DepartmentName":"Information Technology","TicketDate":"2015-04-16","TicketCt":1},{"DepartmentName":"Human Resources","TicketDate":"2015-04-14","TicketCt":1},{"DepartmentName":"Human Resources","TicketDate":"2015-04-15","TicketCt":1}]Here is my code:
@(Html.Kendo().Chart<Guardian.ViewModels.TicketCount>() .Name("LastTwoWeeks_Tickets") .Title("Ticket Count In The Past 30 Days") .Legend(legend => legend .Position(ChartLegendPosition.Top) ) .DataSource(ds => ds.Read(read => read .Action("_NewTicketCtOverTwoWeeks_Read", "Home")) .Group(group => group.Add(model => model.DepartmentName)) .Sort(sort => sort.Add(model => model.TicketDate).Ascending()) ) .Series(series => series.Line(model => model.TicketCt).Name("#= group.value #")) .CategoryAxis(axis => axis .Categories(model => model.TicketDate) ) .ValueAxis(axis => axis.Numeric() .Labels(labels => labels.Format("{0:N0}")) ) .Tooltip(tooltip => tooltip .Visible(true) .Shared(true) .Format("{0:N0}") ) )