I'm failing somewhere in my load of a TreeList. I added a simple error handler like this:
<
script
id
=
"icon-template"
type
=
"text/x-kendo-template"
>
<
div
class
=
'group-photo'
style
=
'background-image: url(@Url.Content("~/images/32/neighbourhood.png"));'
></
div
>
<
div
class
=
'group-name'
>#: Name #</
div
>
</
script
>
<
div
class
=
"demo-section k-content"
>
<
h4
>Customer Groups</
h4
>
@(Html.Kendo().TreeList<
GsiPortal.Models.Group
>()
.Name("treelist")
.Columns(columns =>
{
columns.Add().Field(e => e.Name).Width(220).TemplateId("icon-template");
columns.Add().Field(e => e.Description);
columns.Add().Field(e => e.AddTimestamp).Width(220).Title("Timestamp").Format("{0:MMMM d, yyyy}");
columns.Add().Command(c => { c.CreateChild().Text("Add"); }).HtmlAttributes(new {style = "text-align: center;"});
columns.Add().Command(c => { c.Edit(); }).HtmlAttributes(new { style = "text-align: center;" });
columns.Add().Command(c => { c.Destroy(); }).HtmlAttributes(new { style = "text-align: center;" });
})
.Editable(e => e.Mode(TreeListEditMode.PopUp).TemplateName("GroupEdit"))
.Selectable(selectable => selectable.Mode(TreeListSelectionMode.Single))
.DataSource(dataSource => dataSource
.ServerOperation(false)
.Create(create => create.Action("CreateJson", "Groups"))
.Read(read => read.Action("AllJson", "Groups")
.Data("groupsRead"))
.Update(update => update.Action("UpdateJson", "Groups"))
.Destroy(delete => delete.Action("DestroyJson", "Groups"))
.Model(m =>
{
m.Id(f => f.Id);
m.ParentId(f => f.ParentId);
m.Expanded(true);
m.Field(f => f.Name);
m.Field(f => f.Description);
m.Field(f => f.AddTimestamp).Editable(false);
})
.Events(x => x.Error("onError"))
))
<
script
>
var groupId = Number(@(ViewBag.GroupId));
function groupsRead() {
return { id: groupId };
}
function onError(e) {
alert(e.toString());
}
</
script
>
However, this doesn't give me any clue as to what object type is there to pull the message from. What is the recommended way of doing Error Handling with this control that will give me some actionable information?
Thanks, Joel
I've implemented PDF export functionality with a Grid. I'm trying to set the column width (auto) for one of columns of the report that gets generated because the some values in the column of the report are being truncated, or not seen in the PDF. I've tried
/* doesn't work */
.k-pdf-export colgroup > col {
width: auto !important;
}
/* doesn't work */
.k-pdf-export colgroup > col:nth-child(2) {
word-wrap: break-word;
}
/* makes the column as large as the report, completely useless */
.k-pdf-export colgroup > col:nth-child(2) {
width: 100% !important;
}
/* this works! But I don't want to hard code in a value */
.k-pdf-export colgroup > col:nth-child(2) {
width: 200px !important;
}
Attached is the same grid header displays on Chrome and Edge browser.
Is there a way to force the header not to display C... in Chrome?
var RHCenterOverFlow = "text-align:center; font-size:10px; font-weight:bold; padding:0.5px; overflow:visible; white-space:normal";
columns
.Bound(c => c.Class)
.Title("Class")
.HeaderHtmlAttributes(new { style = RHCenterOverFlow })
.Width(40)
.MinResizableWidth(40);
Thanks.
I am populating a grid with dynamic data. I would like to center all but the left column horizontally. The left column should be left-aligned. I've looked at some examples and have not been able to get it to work. My code follows the pattern below. Where/how can I center align all columns that are not the one with the name "LeftMostColumn?" I've mocked up a couple of places where I think this might happen. Please advise. Thanks!
@(Html.Kendo().Grid<
dynamic
>()
.Name("Grid")
.Columns(columns =>
{
foreach (System.Data.DataColumn column in Model.MyDataData.Columns)
{
var c = columns.Bound(column.ColumnName);
if (column.ColumnName != "LeftMostColumn")
{
// center the contents of the column
}
}
})
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
foreach (System.Data.DataColumn column in Model.MyDataData.Columns)
{
var field = model.Field(column.ColumnName, column.DataType);
if (column.ColumnName != "LeftMostColumn")
{
// center the contents of the field?
}
}
}).Read(read => read.Url(Url.Page("./MyData", new { handler = "GetData_Read" })).Data("forgeryToken"))
)
)
Hello,
I have a kendo grid that uses two foreign keys. The drop-down created has the first parameter, which is for example 1 and 2. For one and two they each have the same four choices in the second parameter drop-down. When the drop down is open you can see the four choices twice for each parameter though they are the same. Is there a way to when is selected in the first drop down to only show the options for that parameter and not the options for the other as well?
Hello Telerik Team
Is there any way to upload an excel file by using angular 2 ?
actually I looking for way that when i uploaded my excel file , the excel data display in to Kendo Grid
thanks in advance
I'm trying to write a graph where the user can configure what data she wants to see.
I implemented a first version based on the remote data binding demo that uses a model describing all data point of the given "column":
Html.KendoEscapeTemplate(Html.Kendo().Chart<
Peppermint.ApplicationCore.ViewModel.FiscalYearSerieDataPointVM
>() ...
With the VM being:
public class FiscalYearSerieDataPointVM
{
public int MonthNumber { get; set; }
public decimal CurrentFiscalYearDataPoint { get; set; }
public decimal? PreviousFiscalYearDataPoint { get; set; }
}
That, obviously, will not work when the char is configured by the user and could have any number of different lines. It's also not very practical to generate data in a "vertical" format because I have to run all queries first and then pivot the result into a collection of FiscalYearSerieDataPointVM
How am I supposed to work around that problem? Am I supposed to use a dynamic object instead of a ViewModel?
I'm having trouble accessing switches in a grid column. I want to loop through them and toggle them on after clicking a toolbar button.
The click event is working. But getting 'undefined' on 'switchInstance ':
Column with switches code:
.Columns(columns =>
{
columns.Bound(p => p.Exempt).Width(100).Filterable(ftb => ftb.Multi(true)).Sortable(false).ClientTemplate(
"<input class='exemptSwitch' id='exemptSwitch' \\#if (Exempt) { \\# checked='checked' \\# } \\# type='checkbox' />");
})
Toolbar button code:
.ToolBar(toolBar =>
{
toolBar.Custom()
.Name("EnableAllFiltered")
.Text("Enable All Filtered")
.IconClass("k-icon k-i-play")
;
})
Click event code:
$(function () {
$(".k-grid-ExemptAllFiltered", "#SubscriberGrid").on("click", function (e) { <--- click of custom grid header toolbar button
$("#SubscriberGrid .exemptSwitch").each(function () {
var switchInstance = $(this).data("kendoSwitch");
switchInstance.enable(true);
});
});
Any assistance would be greatly appreciated!
Jon
Hi,
Could you confirm the necessary requirements to get the Form validation working please?
We create a new project using the Telerik asp.net core 3.1 web MVC project, standard layout choices.
Create a model class with [Required] annotated fields.
Create a new "Create" view with the Form for the model, copying code from the Form examples and from the documentation but the onblur validation never fires?
Do we need jquery-validate files?
What are we missing that triggers the validation?
Thanks,
Daniel.