Hi,
unfortunately after upgrading to the latest Version my application has serveral errors. The reason seems to be a bug in server-filtering.
Try
https://demos.telerik.com/aspnet-mvc/grid/serverbinding
Filter column product ID = 1 => It works
Then filter column product ID = 1 OR product ID = 2 => Error
The internal error is a NullReferenceException (see attach file).
Not so good...
Bye, Michael
I have the Column Menu on my grid to allow users to lock some columns. However, when I use the columnMenu the filter option shows with the arrow next to it but the sub menu for the filter does not show at all. Any idea what I am doing wrong? I am using version 2017.3.913.
Here is my grid code:
@model IEnumerable<Saturn.Models.ListData>
<div class="BordRSolThin">
@(Html.Kendo().Grid(Model)
.Name(componentName: "EditGrid")
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action(actionName: "EditGrid_Read", controllerName: "List")
.Data("getEditData"))
.PageSize(pageSize: 500)
)
.Columns(columns =>
{
columns.Command(command => command.Custom(name: "Edit").Click(handler: "editRevision")).Width(pixelWidth: 75).Locked(true).Lockable(false);
columns.Bound(p => p.CoreID).Title(text: "CoreID").Width(pixelWidth: 100);
columns.Bound(p => p.ProjID).Title(text: "ProjID").Width(pixelWidth: 100);
columns.Bound(p => p.ListRev).Title(text: "ListRev").Width(pixelWidth: 100);
columns.Bound(p => p.SYSID).Title(text: "SYSID").Width(pixelWidth: 100).Locked(true).Lockable(true);
columns.Bound(p => p.FGrp).Title(text: "FGrp").Width(pixelWidth: 300);
columns.Bound(p => p.REDUND).Title(text: "REDUND").Width(pixelWidth: 100);
columns.Bound(p => p.NAME).Title(text: "NAME").Width(pixelWidth: 550).Lockable(true);
columns.Bound(p => p.PlanName).Title(text: "PlanName").Width(pixelWidth: 250).Lockable(true);
columns.Bound(p => p.BarrelType).Title(text: "BarrelType").Width(pixelWidth: 100).Lockable(true);
columns.Bound(p => p.TickNo).Title(text: "TickNo").Width(pixelWidth: 100);
})
.Pageable(pageable => pageable
.Input(enabled: true)
.Numeric(enabled: false)
.Refresh(enabled: true)
)
.Sortable()
.ColumnMenu()
.Scrollable(scr => scr.Height(pixelHeight: 700))
.Selectable()
.Filterable()
)
</div>
I am creating a Kendo grid with a datetime column. I want to group the date column so that it is descending. The latest date is on top and the earliest on the bottom. I have come across this line of code
groups => groups.AddDescending(true)
But it says that there is no definition for AddDescending. How do I change the grouping? Here is how my grid is defined.
@(Html.Kendo().Grid<
LogModel
>()
.Name("Log")
.Columns(columns =>
{
columns.Bound(m => m.dateTimeChangeDate)
.Title("Date and Time")
.ClientTemplate("#= ChangeDate#")
.ClientGroupHeaderTemplate("#= formatUtcDateToLocal(value, 'MM/DD/YYYY')#")
.Width("12%");
columns.Bound(m => m.Component)
.Title("Component")
.Width("8%")
.Filterable(filterable => filterable
.UI("componentFilter")
.Extra(false)
.Operators(operators => operators
.ForString(str => str.Clear()
.Contains("Contains")
))
);
columns.Bound(m => m.Action)
.Title("Action")
.Width("15%")
.Filterable(filterable => filterable
.UI("actionFilter")
.Extra(false)
.Operators(operators => operators
.ForString(str => str.Clear()
.Contains("Contains")
))
);
columns.Bound(m => m.Changer)
.Title("Changer")
.Width("10%");
columns.Bound(m => m.Identifier)
.Title("On")
.Width("15%");
columns.Bound(m => m.OldValue)
.Title("Old Value")
.Width("20%");
columns.Bound(m => m.NewValue)
.Title("New Value")
.Width("20%");
})
.Filterable()
.Selectable()
.Sortable()
.Groupable()
.Resizable(resize => resize.Columns(true))
.ToolBar(toolbar =>
{
toolbar.Template(
@<
text
>
<
a
class
=
"k-button k-button-icontext k-grid-excel"
href
=
"#"
><
span
class
=
"k-icon k-i-excel"
></
span
>Export to Excel</
a
>
<
span
style
=
'padding-left:35%;font-weight:bold;padding-top:7px'
>@ViewBag.ProjectNumber</
span
>
<
span
style
=
'float:right;font-weight:bold;padding-top:7px'
>Total: <
span
id
=
"change-log-record-count"
>@ViewBag.ChangeLogRecordAmount</
span
> records</
span
>
</
text
>
);
})
.Excel(excel => excel.AllPages(true).FileName(@ViewBag.ChangeLogType + " Change Log " + @ViewBag.ProjectNumber + ".xlsx").Filterable(true))
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(p => p.Id);
})
.Read(read => read.Action("FetchChangeLogData", "ChangeLog")
.Data("buildParam"))
)
.Events(e => e.FilterMenuInit("resizeFilter")
.ExcelExport("modifyFormatForExcel")
.DataBound("preselectCustomFilter"))
.ClientDetailTemplateId("change-log-details-template")
)
How can we select the node that is clicked on by a right click event? I am trying to pass the selected node's id on a context menu select event but unless the user left clicks on the node to select it first, the last selected node information gets sent, if one was even selected.
This may be fairly basic, but I can't find any examples of this.
Thanks.
Hi Telerik,
I want to know how to add a TreeView inside DropDownList with MVC like your demo in ASP.NET AJAX http://demos.telerik.com/aspnet-ajax/treeview/examples/functionality/treeviewcombobox/defaultcs.aspx?product=treeview
Can you please help me to resolve this issue?
Thanks
I have a tabstrip that loads its content from partial views, and this works well provided the routeValues never change. For example:
@(Html.Kendo().TabStrip()
.Name("MyTabStrip")
.Items(i =>
{
i.Add().Text("First Tab").LoadContentFrom("FirstAction", "MyController", new { id = ViewData["id"] });
i.Add().Text("Second Tab").LoadContentFrom("SecondAction", "MyController", new { id = ViewData["id"] });
})
)
This will hit FirstAction and SecondAction when the tabs are selected, and carry the id along from ViewData, this is fine.
...but if "id" is a more dynamic bit of data, that needs to change on the page, this approach is no longer valid.
The TabStrips do not have any Data function, akin to what can be found in the Read attribute in a regular DataSource, which would have been nice, and there is nothing too helpful in the Select event of the TabStrip. I have tried editing the _contentUrls list inside the TabStrip element, but this does not seem to work, either; it seems this is populated when the element is created, but not actually used.
...so how can this be done? Is there any way to update the content urls of an existing tab?
I need to add a horizontal scrollbar at the top of the kendo grid. I've attached a screenshot of what I'd like to be able to do.
Thanks
I
have this autocomplete in my application.
@(Html.Kendo().AutoComplete()
.Name("Name")
.Placeholder("Please select something...")
.Delay(300)
.MinLength(2)
.DataTextField("Field")
.DataSource(source => source
.Read(read => read
.Action("SomeAction", "SomeController")
.Data("SomeData"))
.ServerFiltering(true))
.Events(x => x
.Select("onSelect")
.DataBound("onDataBound ")
.Change("onChange "))
)
It retrieves elements from a table that match a certain condition. On select, in the backend, I change that condition and add the selected element to a grid, which means that that element will not show up in the autocomplete from now on.
@(Html.Kendo().Grid<ViewModel>()
.Name("Name")
.Deferred()
.ClientRowTemplate(Html.Partial("RowTemplate").ToHtmlString())
.TableHtmlAttributes(new
{ @class = "table table-stripped" })
.Events(e => e.Change("onChange").DataBound("onDataBound"))
.Resizable(res => res.Columns(true))
.Columns(columns =>
{
columns.Bound(e => e.Code);
columns.Bound(e => e.Title);
})
.Filterable()
.Sortable()
.Selectable()
.Pageable(x =>
{
x.ButtonCount(3);
x.Enabled(true);
x.PageSizes(new[] { "10", "20", "30" });
x.Refresh(true);
})
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("SomeAction", " SomeController "))
.ServerOperation(true)
))
When I select it
in the grid, it restores the condition, which means that element can show up in
the autocomplete results again.
This works
fine. The problem is that once I change the condition for an element, if I do
the same search again, the read action won’t be called, so I won’t get modified
elements from the table.
For example, if I do a search on “Doc”, I will get Doc1, Doc2 and Doc3, and if
I select Doc1, it will show up in the grid. Now it should not be available as a
result in the autocomplete since it no longer matches the initial condition.
If I search “Doc” again, I will get the same result. Doc1 is still there, but if I search “Doc1”, since there was actually a read, it won’t be in the results, which is expected.
So, how can I force an actual read every time I do a search to prevent this situation?