Greetings,
I'm working on an issue with our Kendo UI...essentially i have a parent node and i want to add a child node and have the change show up immediately like it does in the Kendo UI example. Upon clicking Add for a new child node, i can enter my details and update the row.
In the example shown here: https://demos.telerik.com/aspnet-mvc/treelist/editing you'll see once the update button is clicked the row automatically updates and you can see the child node you've created.
My issue is that once i click the update button the row disappears and only a page refresh will show the new child node row.
The error i get when trying to update the row is a generic: POST http://localhost:16922/Rackhouses/RackhouseTreeList_Add 500 (Internal Server Error)
Here's my cshtml for the treelist:
@(Html.Kendo().TreeList<WhiskeySystems.ViewModels.RackhouseTreeListItemVM>
()
.Name("treelist")
.Toolbar(toolbar => toolbar.Create().Text("Add Rackhouse"))
.Columns(columns =>
{
columns.Add().Field(e => e.Name).Title("Name").Width(220);
columns.Add().Field(e => e.InMyBond).Title("In My Bond").Width(100).Template("<input type='checkbox' data-bind='checked: InMyBond' onclick='return false;'/>" );
columns.Add().Field(e=> e.Tiers).Title("Tiers");
columns.Add().Field(e => e.Rows).Title("Rows");
columns.Add().Field(e => e.Capacity).Title("Capacity");
columns.Add().Width(300).Command(c =>
{
c.Edit();
c.Destroy();
c.CreateChild().Text("Add Zone");
c.Custom().Name("defaultZone").ClassName("zoneDefault").Click("setDefaultZone").Text("Set Default");
});
})
.Editable(e=>e.Mode("inline"))
.DataSource(dataSource => dataSource
.Create(create => create.Action("RackhouseTreeList_Add", "Rackhouses"))
.Read(read => read.Action("RackhouseTreeList_Read", "Rackhouses"))
.Update(update => update.Action("RackhouseTreeList_Update", "Rackhouses"))
.Destroy(delete => delete.Action("RackhouseTreeList_Delete", "Rackhouses"))
.Events(e=> { e.Error("onError"); e.RequestEnd("requestEnd"); })
.Model(m => {
m.Id(f => f.Id);
m.ParentId(f => f.ParentId);
m.Expanded(true);
m.Field(f => f.Capacity);
m.Field(f => f.DistilleryId);
m.Field(f => f.InMyBond);
m.Field(f => f.InvTypeId);
m.Field(f => f.Name);
m.Field(f => f.Rows);
m.Field(f => f.Tiers);
})
)
.Events(e => { e.DataBound("OnDataBound"); e.Edit("OnEdit"); })
)
Heres my TreeList Add code for the controller:
public JsonResult RTreeList_Add([DataSourceRequest] DataSourceRequest request, RTreeListItemVM VM) { using (var contextScope = _scope.Create()) { try { _RBS.AddRTreeListItemVM(VM); contextScope.SaveChanges(); //Assign the new Id back to the VM after saving. if (VM.ParentId.HasValue) { VM.Id = VM._zone.Id + 0.2m; } else { VM.Id = VM._r.Id + 0.1m; } } catch (Exception ex) { ModelState.AddModelError("Error", ex.Message); } return Json(new[] { VM }.ToTreeDataSourceResult(request, ModelState), JsonRequestBehavior.AllowGet); } }
I've done quite a bit of troubleshooting and cant seem to find anything that stands out. Made sure my scripts are running in the right order. Im new to kendo so still trying to ramp up my knowledge here. Thanks in advance!
Hi,
In the export to Excel from Kendo grid have problem.
Can I put one field as textual, one as a date and all others as a number? When exporting, they all come to me as numbers, so I have a problem with XLSX that eats the first 0, and I would like to put that field in textual.
This is my code:
SpreadDocumentFormat exportFormat = SpreadDocumentFormat.Xlsx;
Action<ExportCellStyle> cellStyle = new Action<ExportCellStyle>(ChangeCellStyle);
Action<ExportRowStyle> rowStyle = new Action<ExportRowStyle>(ChangeRowStyle);
Action<ExportColumnStyle> columnStyle = new Action<ExportColumnStyle>(ChangeColumnStyle);
List<ExportColumnSettings> columnsData = new List<ExportColumnSettings>();
//columnsData.Add(new ExportColumnSettings() { Field = "RB", Title = "R.b.", Hidden = false, Format = null });
columnsData.Add(new ExportColumnSettings() { Field = "BR", Title = "BR", Hidden = false, Format = null });
columnsData.Add(new ExportColumnSettings() { Field = "Date", Title = "Date", Format = "{0:MM/dd/yyyy}", Hidden = false });
columnsData.Add(new ExportColumnSettings() { Field = "Name", Title = "Naziv i sjediĆĄte", Format = null, Hidden = false });
columnsData.Add(new ExportColumnSettings() { Field = "OIB", Title = "OIB", Format = "@", Hidden = false });
columnsData.Add(new ExportColumnSettings() { Field = "Iznos", Title = "Iznos rn.", Format = null, Hidden = false });
and my settings for Cell style:
private void ChangeCellStyle(ExportCellStyle e)
Thnx,
Andrea
Hi!
I'm using the TileLayout which needs BodyTemplateId to Render. Inside my assigned BodyTemplateId I have this code below which works if the data from Address does not contain a hash (#) character. Say, the Address from the database is "UNIT #1 ABC BLDG" will not render the TextArea.
Code:
<script id="address-template" type="text/x-kendo-template">
<div class="row">
<div class="text-left col-md-1">
@Html.LabelFor(m => m.CompleteAddress, "Address")
</div>
<div class="col-md-5">
@(Html.Kendo().TextAreaFor(m => m.CompleteAddress).Rows(2)
.Readonly(true)
.ToClientTemplate()
)
</div>
</div>
</script>
@(Html.Kendo().TileLayout()
.Name("TileLayout")
.Columns(4)
.RowsHeight("20px")
.Containers(c =>
{
c.Add().BodyTemplateId("address-template").ColSpan(4).RowSpan(6);
})
)
What to do?
Thanks!
RGA
I have a grid with in-line editing enabled. This works well.
There is now a requirement to disable editing of the displayed records, depending on the filter selected (at the top of the page). I need a way to simply turn on or off editing via JavaScript .
Please note, this isn't conditional editing, the filter is selected via controls on the top of the page, which then trigger a data source read. Depending on the chosen filter date (i.e. in the past) I need to simply disable editing of all the displayed records.
Thanks
Hi I am getting the following error.
'Kendo is not defined'
I have bundelled and include the following in _layout.cshtml
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
@Styles.Render("~/Content/kendo/css")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/kendo")
@RenderSection("scripts", required: false)
</head>
and at the end body i have the following
@Scripts.Render("~/bundles/bootstrap")
The layout page it self looks ok , but when I display the partial view page with data. The grid data displays as a list but not as kendo grid view and the error shows kendo is not defined.
Thanks
I have a menu, using v2022.2.802 and I need to reduce the padding on the top level of the menu. The documentation does not include any examples on how to do this.
What styles need to be changed to reduce the padding on the menu? I have reduced the font-size by using:-
.k-menu-link-text { font-size: smaller !important; }
But this still leaves a larger amount of padding on the top level menu.
Thanks
Is there a solution for assigning a unique ID to a table strip item? Currently I can see an example where you can reference the TabStip item name with the following however I need to assign a unique ID because the item name of my tabs can vary. The ordinal position can vary also.
$(e.item).find("> .k-link").text()
Hi,
one of our customers currently has difficulties uploading multiple images asynchronous. Single images seem to be ok.
We're already using the option Batch(false), so images arrive one at a time at the server.
The uploads seem to occur simultaneously, though. Is there an option to also upload these sequentially, or do we need to use the synchronous mode in this case?