Hello there
I'm wondering if it is possible to select the last item inside a node. Example:
A + (main node)
A1 + (child node of A)
A2 + (child node of A)
B + (main node)
The plus sign (icon) behind each item is kinda an add item functionality inside that node. F.e. if I click on the + behind the A it would create a child item inside its node, in this case A3 + :
A + (clicked on the +)
A1 +
A2 +
A3 + (new item created)
B +
That works fine. What I want now after creating a newitem that way is to SELECT (jump) the newly created item:
A +
A1 +
A2 +
A3 + (item is selected)
B +
I'm aware of this: treeview.select(".k-item:last");
In my case it would jump to B + (always to the end of the very last item. Can I somehow (easily) restrict the "last" so it would jump to the last element inside the node I have added a new item?
Regards
Hi,
I have found a problem when having text with ampersand in the data used for a pivot grid when expanding the row or column with that ampersand in the caption. A JavaScript exception is caused in the browser (Chrome & IE). The exception is "Uncaught TypeError: Cannot read property 'value' of undefined at init._buildRow" in kendo.all.js:73938. The undefined object is dataItem.
I have encoded the ampersand using & within the string at the datasource and whilst that is displayed correctly I believe the & within the encoded & is still causing the exception. I have tried using the rowHeaderTemplate and the row encoded property but neither seem to stop the error from occurring. Is there another way I should be encoding this text so that it doesn't break the JavaScript code?
My original project is Kendo UI for MVC but I have created a dojo using the JavaScript version to re-create the problem.
dojo.telerik.com/@amdenley/OkEqIV/2
I have a grid on an MVC page, I have an error event as follows:
.DataSource(dataSource => dataSource
.Ajax()
.Batch(false)
.PageSize(50)
.Events(events => events.Error("gridErrorHandler"))
My JavaScript function is something like:
function gridErrorHandler(e) {
...
}
I have an MVC method (that returns ActionResult) that throws the following error when an error condition occurs:
return new HttpStatusCodeResult(System.Net.HttpStatusCode.InternalServerError, "Unexpected error");
My question is this. When my MVC method throws an exception, my JS error handler gets called. But, no matter what I try, I'm not able to get at the type of error it is. What exactly is the correct JS code that tells me a 500 error occurred, or a 401 (unauthorized) error occurred, etc.?
@model VentSettings<div class="k-toolbar k-grid-toolbar"> <a class="k-button k-button-icontext k-add-button" href="#"><span class="k-icon k-add"></span>Add new record</a></div><script type="text/x-kendo-tmpl" id="ventTemplate"> <div> <div class="edit-buttons" style="width:98%; background:lightgray; border:1px solid lightgray; padding:10px;">#:Time# <a style="float:right" class="k-button k-button-icontext k-edit-button" href="\\#"><span class="k-icon k-edit"></span>Edit</a> <a style="float:right" class="k-button k-button-icontext k-delete-button" href="\\#"><span class="k-icon k-delete"></span>Delete</a> </div> <div style="width: 98%; padding:10px; border:1px solid lightgray;"> <span style="width:10%; display: inline-block">Rate:</span><span style="width:22%; display:inline-block">#:Rate# per min</span> <span style="width:10%; display: inline-block">PIP:</span><span style="width:22%; display:inline-block">#:PIP# cm H<sub>2</sub>O</span> <span style="width:10%; display: inline-block">PEEP:</span><span style="width:22%; display:inline-block">#:PEEP# cm H<sub>2</sub>O</span> <span style="width:10%; display: inline-block">MAP:</span><span style="width:22%; display:inline-block">#:MAP# cm H<sub>2</sub>O</span> <span style="width:10%; display: inline-block">Vent:</span><span style="width:50%; display:inline-block">#:VentDescription# </span> </div> </div></script>@(Html.Kendo().ListView<VentSetting>(Model.VentSettingsList) .Name("listView") .TagName("div") .ClientTemplateId("ventTemplate") .Editable() .DataSource(datasource => datasource .Events(events => events.Sync("handleSync")) .Model(model => model.Id(m => m.VentSettingId)) .Read(read => read.Action("ReadVentSettings", "RunDetail")) .Create(create => create.Action("CreateVentSetting", "RunDetail")) .Update(update => update.Action("UpdateVentSetting", "RunDetail")) .Destroy(destroy => destroy.Action("DeleteVentSetting", "RunDetail")) ))<script>function handleSync() { this.read();}</script><div style="padding:10px"> @Html.ValidationSummary(true) <span style="width:12%; display:inline-block">Resp Rate: </span> <span style="width:36%; display:inline-block"> @Html.Kendo().DropDownListFor(x => x.VentTypeId).DataValueField("VentTypeId").DataTextField("Description").BindTo((System.Collections.IEnumerable)ViewData["VentTypes"])</span> <div class="edit-buttons"> <a class="k-button k-button-icontext k-update-button" href="\\#"><span class="k-icon k-update"></span>Save</a> <a class="k-button k-button-icontext k-cancel-button" href="\\#"><span class="k-icon k-cancel"></span>Cancel</a> </div></div>[HttpPost]public ActionResult CreateVentSetting([DataSourceRequest] DataSourceRequest request, Models.VentSetting modelVentSetting){ if (modelVentSetting != null && ModelState.IsValid) { // Create code... } return Json(ModelState.ToDataSourceResult());}[HttpPost]public ActionResult UpdateVentSetting([DataSourceRequest] DataSourceRequest request, Models.VentSetting modelVentSetting){ // Update code... return Json(ModelState.ToDataSourceResult());}Hi,
Does the chart have a single property where I can set the font-family for all of the text elements (title, legend, tooltip, axis label, axis title, etc) that the chart may contain?
I'd like to apply our fonts to charts but not have to set half a dozen or more properties if it can be avoided.
Thanks!
Hey,
I'm currently trying to use batch syncing with the server using the DataSource's transport.submit handler. The documentation tells me to pass a method, and to set batch to true on the DataSource itself in order to work properly. To my surprise I'm facing an exception with the following stacktrace:
Uncaught TypeError: Cannot read property 'data' of undefined at init.setup (VM3012 kendo.all.min.js:27) at init.update (VM3012 kendo.all.min.js:27) at Object.<anonymous> (VM3012 kendo.all.min.js:27) at Function.Deferred (VM2971 jquery.min.js:2) at init._promise (VM3012 kendo.all.min.js:27) at init._send (VM3012 kendo.all.min.js:27) at init.sync (VM3012 kendo.all.min.js:27) at init.saveChanges (VM3012 kendo.all.min.js:50) at HTMLAnchorElement.<anonymous> (VM3012 kendo.all.min.js:50) at HTMLDivElement.dispatch (VM2971 jquery.min.js:3)
A workaround would be to set the method after grid initialization (code below), but I'm wondering what could be wrong with my initial syntax/code.
var grid = $("#grid").data("kendoGrid");grid.dataSource.transport.submit = function(e) { alert("alternate submit"); };
Reproduction (DoJo): Try to (inline) edit a row, then press 'save changes', using the code below:
<!DOCTYPE html><html><head> <base href="http://demos.telerik.com/kendo-ui/grid/editing"> <style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style> <title></title> <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.2.621/styles/kendo.common-material.min.css" /> <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.2.621/styles/kendo.material.min.css" /> <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.2.621/styles/kendo.material.mobile.min.css" /> <script src="https://kendo.cdn.telerik.com/2017.2.621/js/jquery.min.js"></script> <script src="https://kendo.cdn.telerik.com/2017.2.621/js/kendo.all.min.js"></script></head><body> <div id="example"> <div id="grid"></div> <script> $(document).ready(function () { var crudServiceBaseUrl = "https://demos.telerik.com/kendo-ui/service", dataSource = new kendo.data.DataSource({ transport: { read: { url: crudServiceBaseUrl + "/Products", dataType: "jsonp" }, submit: function(e) {alert("submit"); } }, batch: true, pageSize: 20, schema: { model: { id: "ProductID", fields: { ProductID: { editable: false, nullable: true }, ProductName: { validation: { required: true } }, UnitPrice: { type: "number", validation: { required: true, min: 1} }, Discontinued: { type: "boolean" }, UnitsInStock: { type: "number", validation: { min: 0, required: true } } } } } }); $("#grid").kendoGrid({ dataSource: dataSource, navigatable: true, pageable: true, height: 550, toolbar: ["create", "save", "cancel"], columns: [ "ProductName", { field: "UnitPrice", title: "Unit Price", format: "{0:c}", width: 120 }, { field: "UnitsInStock", title: "Units In Stock", width: 120 }, { field: "Discontinued", width: 120, editor: customBoolEditor }, { command: "destroy", title: " ", width: 150 }], editable: true }); /* Workaround: var grid = $("#grid").data("kendoGrid"); grid.dataSource.transport.submit = function(e) { alert("alternate submit"); }; */ }); function customBoolEditor(container, options) { $('<input class="k-checkbox" type="checkbox" name="Discontinued" data-type="boolean" data-bind="checked:Discontinued">').appendTo(container); $('<label class="k-checkbox-label"></label>').appendTo(container); } </script> </div></body></html>
Kind regards