or
@model IEnumerable<Datamart.Models.ViewModels.LEAFundMap>@{ ViewBag.Title = "CreateFundMap"; var snapshot = Session["snapshot_id"] ?? Request.Params["snapshot_id"];}<h2>CreateFundMap</h2>@(Html.Kendo().Grid(Model).Name("Funds").Columns(cols => { cols.Bound(p => p.entity_fund).ClientTemplate("#=entity_fund#"); cols.Bound(p => p.fund_desc).ClientTemplate("#=fund_desc.fund_desc#"); }).ToolBar(commands => { commands.Save(); }) .Editable(edit => edit.Enabled(true).Mode(GridEditMode.InCell)).DataSource(ds => ds .Ajax() .Model(model => { model.Id(p => p.entity_fund); model.Field(p => p.entity_fund).Editable(false); }) // Configure RU --> .Read(read => read.Action("Fund_Read", "Draft").Data("additionalData")) .Update(update => update.Action("Fund_Update", "Draft").Data("additionalData")) //.ServerOperation(false) .Batch(true) .Events(events => events //.Change("onChange") // commented out because it causes an infinite loop .Error("onError") ) ) // <-- Configure RU )<script>function additionalData() { return { snapshot_id: "@snapshot" };}function onError(e, status) { if (e.errors) { var message = "The following errors have occurred:\n"; $.each(e.errors, function (key, value) { if (value.errors) { message += value.errors.join("\n"); } }); alert(message); }}function onChange() { var grid = $("#Funds").data("kendoGrid"); grid.dataSource.read();}</script>Hi. I just want to display a list of values that are retrieved serverside using AJAX. It calls the AJAX method successfully, but does not display the returned values.
Markup:
@(Html.Kendo().AutoComplete() .Name("EditNameAutoComplete") .DataSource(source => source.Read(read => read.Action("GetUsers", "Administration")) .ServerFiltering(true)))public JsonResult GetUsers() { string input = Request.Params["filter[filters][0][value]"]; var adValues = //Get names from Active Directory that start with our input var users = adValues.Select(user => user.CommonName).ToList(); users.Sort(); return Json(users); }@(Html.Kendo().Grid<MyProject.Business.Models.ParentDTO>().Name("ParentGrid").Columns(cols => cols.Command(o => o.Edit() ).Title(" ")).Editable(editor => editor.Mode(GridEditMode.PopUp)).Events(events=>events.Edit("onEditOfParentGrid")).DataSource(datasource => datasource .Ajax() .Model(model => model.Id(o => o.id)) .Read(read => read.Action("GetAll", "ParentAjax")) .Update(update => update.Action("Update", "ParentAjax")) .Create(create => create.Action("Create", "ParentAjax")) .Destroy(destroy => destroy.Action("Destroy", "ParentAjax")) ))<script type="text/javascript"> function onEditOfParentGrid(e) { $('#ChildGrid').data().kendoGrid.dataSource.read({ id: e.model.id }) }</script>@model MyProject.Business.Models.ParentDTO@(Html.Kendo().Grid<MyProject.Business.Models.ChildDTO>().Name("ChildGrid").AutoBind(false).Editable(edit=>edit.Mode(GridEditMode.InCell)).DataSource(datasource => datasource .Ajax() .Model(model =>model.Id(o => o.id)) .Read(read => read.Action("GetByParentId", "ChildAjax")) .Update(update => update.Action("Update", "ChildAjax")) .Create(create => create.Action("Create", "ChildAjax")) .Destroy(destroy => destroy.Action("Destroy", "ChildAjax"))))In my grid I placed a custom command "Copy" which copies a value of a column to two other values in other columns in the Click-handler CopyClick. Now I would like to enter the edit mode for the row. How can I do that? I tried grid.editRow(row) but it did not worked. Probably I passed the wrong parameter to it. What must row be as a parameter to editRow()?
@(Html.Kendo().Grid<MyViewModel>() .Name("MyGrid") .Columns(columns => { columns.Command(command => { command.Edit(); command.Destroy(); command.Custom("Copy").Click("CopyClick"); }); …… function CopyClick(e) { e.preventDefault(); var grid = $("#UnterhaltGrid").data("kendoGrid"); var dataItem = this.dataItem($(e.currentTarget).closest("tr")); dataItem.Val1 = dataItem.Val0; dataItem.Val2 = dataItem.Val0; grid.refresh(); }