I'm using ASP NET CORE. I have a grid and I enable filtering on a column with .Filterable(). Is there a way to sort the items that appear in the checkbox filter?
EX:
My filter would look like this
And not
When the drop down is displayed.
Hi There,
I'm working on a web app and need to access the Excel column with letters instead of an index. I have gone through the documentation but didn't find how we can access the Excel column with alphabets such as A20
Could you please let me know if you have any functions or not?
Thanks,
I have a nested grid in a client template. Everything on my pages works great. I would like to refresh the parent grid when the nested gid is updated. The only way I have found to do this is to use the RequestEnd event on the nested grid, so I defined it in the gird's data source:
I have a function defined to handle the event:
<script type="text/javascript">
function onCampaignRequestEnd(e) {
console.log('Campaign grid on request end");
var programGrid = $("#programGrid").data("kendoGrid");
programGrid.dataSource.read();
}
</script>
No matter where I put this script on the page, I receive this error when expanding the parent grid. I even tried adding it the parent grid and received the same error. I have similar scripts defined in outer pages and have never see this happen:
3383:1 Uncaught ReferenceError: onCampaignRequestEnd is not defined
Hi,
I upgraded Telerik version in our project (Telerik.UI.for.AspNet.Core nuget) from version 2021.2.616 to version 2023.1.425 and since then is for TabStrip component not working LoadContentFrom.
I have in my controller method like this:
public IActionResult GetProductListPartial()
{
return PartialView("_ProductList");
}
And in my View I have code like this:
@(Html.Kendo().TabStrip() .Name("tabstrip") .Items(tabstrip => { tabstrip.Add() .Text(@Localizer["Menu.ProductList"]) .Selected(true) .LoadContentFrom("GetProductListPartial", "ProductList") .ContentHtmlAttributes(new { @class = "product-list-tab" }); }))
When I reworked implementation in the View, then it started to work again:
@(Html.Kendo().TabStrip()
.Name("tabstrip")
.Items(tabstrip =>
{
tabstrip.Add().Text(@Localizer["Menu.ProductList"])
.Selected(true)
//.LoadContentFrom("GetProductListPartial", "ProductList")
.Content(@<text>@await Html.PartialAsync("_ProductList")</text>)
.ContentHtmlAttributes(new { @class = "product-list-tab" });
}))
I'm wondering if there is any support for styling a Dialog in the .net core version of telerik that I am trialling right now? The documentation lists the ability to add a cssclass but that is only for the button, not for the entire dialog itself, I need to replicate previous functionality we were using where a cssclass is applied to the object in javascript when the dialog has been open for a certain amount of time.
This was the only documentation I could find and it's only able to add a class to the button, not the entire dialog.
Configuration, methods and events of Kendo UI Dialog - Kendo UI for jQuery (telerik.com)
I have a grid defined as such:
@(Html.Kendo().Grid<AuditViewModel>()
.Name("AuditLogGrid")
.Columns(columns =>
{
columns.Bound(c => c.Id).Hidden(true);
columns.Bound(c => c.UserId).HtmlAttributes(new { @class = "k-text-right", style = "vertical-align: text-top" });
columns.Bound(c => c.TableName).HtmlAttributes(new { @class = "k-text-right", style = "vertical-align: text-top" });
columns.Bound(c => c.AuditType).HtmlAttributes(new { @class = "k-text-right", style = "vertical-align: text-top" });
columns.Bound(c => c.KeyValuesValue).Encoded(false).HtmlAttributes(new { @class = "k-text-right", style = "vertical-align: text-top" });
columns.Bound(c => c.OldValuesValue).Encoded(false).HtmlAttributes(new { @class = "k-text-right", style = "vertical-align: text-top" });
columns.Bound(c => c.NewValuesValue).Encoded(false).HtmlAttributes(new { @class = "k-text-right", style = "vertical-align: text-top" });
columns.Bound(c => c.ChangedColumnsValue).HtmlAttributes(new { @class = "k-text-right", style = "vertical-align: text-top" });
})
.Pageable(pager => pager.Refresh(true))
.Sortable()
.Filterable()
.NoRecords()
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.PageSize(10)
.ServerOperation(true)
.Events(events => events.Error("error_handler"))
.Model(model =>
{
model.Id(p => p.Id);
model.Field(p => p.UserId);
model.Field(p => p.TableName);
model.Field(p => p.AuditType);
model.Field(p => p.KeyValuesValue);
model.Field(p => p.OldValuesValue);
model.Field(p => p.NewValuesValue);
model.Field(p => p.ChangedColumnsValue);
})
.Read(read => read.Action("GetAuditLogs", "Audit").Data("forgeryToken"))
))
And in my "GetAuditLogs" controller methods, I pass in the "request.Page" and "request.PageSize" to calculate Skip and Take. The EF query call DOES return records (default is set to 10 records) however when returning from the Controller, the Grid displays "No Records"
My controller method is as follows:
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> GetAuditLogsAsync([DataSourceRequest] DataSourceRequest request)
{
_logger.LogDebug("GetAuditLogsAsync()");
try
{
var logs = await _auditService.GetAsync(null, q => q.OrderByDescending(x => x.DateTime),
string.Empty, request.Page, request.PageSize);
var total = await _auditService.CountAsync(null, string.Empty);
var models = logs.Select(x => new AuditViewModel
{
Id = x.Id,
UserId = x.UserId,
DateTime = x.DateTime,
TableName = x.TableName,
AuditType = x.Type,
KeyValues = string.IsNullOrWhiteSpace(x.PrimaryKey) ? new Dictionary<string, object>() :
JsonSerializer.Deserialize<Dictionary<string, object>>(x.PrimaryKey),
OldValues = string.IsNullOrWhiteSpace(x.OldValues) ? new Dictionary<string, object>() :
JsonSerializer.Deserialize<Dictionary<string, object>>(x.OldValues),
NewValues = string.IsNullOrWhiteSpace(x.NewValues) ? new Dictionary<string, object>() :
JsonSerializer.Deserialize<Dictionary<string, object>>(x.NewValues),
ChangedColumns = string.IsNullOrWhiteSpace(x.AffectedColumns) ? new List<string>() :
JsonSerializer.Deserialize<List<string>>(x.AffectedColumns)
});
var result = await models.ToDataSourceResultAsync(request);
result.Total = total;
return Json(result);
}
catch (Exception ex)
{
_logger.LogError($"GetAuditLogsAsync() | error [{ex}]", ex);
throw;
}
}
And the Audit Service "GetAsync" looks like:
public async Task<IEnumerable<Data.Entities.Audit>> GetAsync(
Expression<Func<Data.Entities.Audit, bool>>? filter = null,
Func<IQueryable<Data.Entities.Audit>, IOrderedQueryable<Data.Entities.Audit>>? orderBy = null,
string includeProperties = "",
int page = 0,
int pageSize = 0)
{
IQueryable<Data.Entities.Audit> query = _dbSet;
if (filter != null)
{
query = query.Where(filter);
}
if (!string.IsNullOrWhiteSpace(includeProperties))
{
query = includeProperties.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
.Aggregate(query, (current, includeProperty) => current.Include(includeProperty));
}
var result = orderBy != null
? orderBy(query)
: query;
if (page > 0 && pageSize > 0)
{
result = result.Skip((page - 1) * pageSize).Take(pageSize);
}
return await result.ToListAsync();
}
I have a grid defined as thus:
@(Html.Kendo().Grid<SubServiceViewModel>()
.Name("SubServiceGrid")
.Columns(columns =>
{
columns.Bound(c => c.Id).Hidden(true);
columns.Bound(c => c.Service)
.ClientTemplate("#=Service.Value#")
.Filterable(false)
.Sortable(false);
columns.Bound(c => c.Value);
columns.Bound(c => c.Active).Hidden(true);
columns.Bound(c => c.Deleted).Hidden(true);
columns.Command(c => c.Destroy());
})
.ToolBar(toolbar =>
{
toolbar.Create();
toolbar.Save();
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Pageable(pager => pager.Refresh(true))
.Sortable()
.Filterable()
.NoRecords()
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.PageSize(10)
.ServerOperation(true)
.Events(events => events.Error("error_handler").RequestEnd("onRequestEnd('staticNotifications')"))
.Model(model =>
{
model.Id(p => p.Id);
model.Field(p => p.Service).DefaultValue(ViewData["defaultService"] as ServiceViewModel);
model.Field(p => p.Value);
model.Field(p => p.Active).DefaultValue(EntityLiterals.Yes);
model.Field(p => p.Deleted).DefaultValue(EntityLiterals.No);
})
.Read(read => read.Action("GetSubServices", "SubService").Data("forgeryToken"))
.Create(create => create.Action("CreateSubServices", "SubService").Data("forgeryToken"))
.Update(update => update.Action("UpdateSubServices", "SubService").Data("forgeryToken"))
.Destroy(destroy => destroy.Action("DeleteSubServices", "SubService").Data("forgeryToken"))
))
And if I remove the
.Filterable(true)
I get a JS error when I click the column filter button
Uncaught TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at C (kendo.all.js:318535:21)
at init._createForm (kendo.all.js:318535:21)
at init._init (kendo.all.js:318535:21)
at init._click (kendo.all.js:318535:21)
at HTMLAnchorElement.dispatch (jquery.min.js?v=oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl-cbzUq8:2:43184)
at y.handle (jquery.min.js?v=oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl-cbzUq8:2:41168)
C @ kendo.all.js:318535
_createForm @ kendo.all.js:318535
_init @ kendo.all.js:318535
_click @ kendo.all.js:318535
dispatch @ jquery.min.js?v=oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl-cbzUq8:2
y.handle @ jquery.min.js?v=oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl-cbzUq8:2
I'm using Trial for testing. But when the number of items is selected more, the text box displaying the item grows larger, breaking the interface of the page. I just want to show the number of selected items (Checked) to replace checked items, is it possible to process? Please guide how. Displays fine both when the event is selected and the initial default load of items is checked.
Example: