Hey there guys, I've spent a good amount of time looking through other people's issues for this problem and haven't found it addressed yet.
Basically the problem I'm experiencing is trying to create an extension method to HtmlHelper (which works fine), but for some reason setting up corrected operators on filterable is causing issues. Here the code I am trying to use:
public
static
GridBuilder<T> ExtensionGrid<T>(
this
IHtmlHelper<dynamic> helper,
string
name)
where T :
class
{
return
helper.Kendo().Grid<T>()
.Name(name)
.Filterable(filterable => filterable
.Extra(
false
)
.Operators(operators => operators
.ForString(str => str
.Clear()
.Contains(
"Contains"
)
.DoesNotContain(
"Does not contain"
)
.StartsWith(
"Starts with"
)
.EndsWith(
"Ends with"
)
.IsEqualTo(
"Is equal to"
)
.IsNotEqualTo(
"Is not equal to "
)
// <== trailing space is intentional.
)
)
)
.Pageable(pager => pager
.ButtonCount(5)
.PageSizes(
new
int
[] { 5, 10, 20, 50, 100, 150, 200 })
.Input(
true
)
.Refresh(
true
)
)
.Sortable(sortable => sortable
.Enabled(
true
)
.AllowUnsort(
false
)
)
.Events(events =>
{
events.FilterMenuInit(
"trapKendoGridFilterEnterKey"
);
});
}
I can see the UI responding to the Extra(false) piece, but not to the ForString() piece (still just seeing the default string operators). I also see the same behavior when I apply it directly to a grid like this:
@(Html.Kendo().Grid<Role>()
.Name(
"RoleGrid"
)
.Columns(columns =>
{
columns.Bound(c => c.RoleId)
.Hidden(
true
);
columns.Bound(c => c.RoleCode);
columns.Bound(c => c.RoleName);
columns.Bound(c => c.RoleDescription);
columns.Bound(c => c.RoleDisplayOrder);
})
.Filterable(filterable => filterable
.Extra(
false
)
.Operators(operators => operators
.ForString(str => str
.Clear()
.Contains(
"Contains"
)
.DoesNotContain(
"Does not contain"
)
.StartsWith(
"Starts with"
)
.EndsWith(
"Ends with"
)
.IsEqualTo(
"Is equal to"
)
.IsNotEqualTo(
"Is not equal to "
)
)
)
)
.Scrollable()
.Selectable()
.Sortable()
.Pageable(pageable => pageable
.ButtonCount(5)
.PageSizes(
new
int
[] { 5, 10, 20, 50, 100, 150, 200 })
.Input(
true
)
.Refresh(
true
)
)
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(m => m.RoleId);
model.Field(m => m.RoleId).Editable(
false
);
})
.Events(events => events
.Error(
"ajaxErrorHandlerForGrid('RoleGrid')"
)
)
.Read(read => read.Action(
"Role_Read"
,
"Shared"
))
)
)
The only time I do see it working is with a row level filter such as this:
@(Html.Kendo().Grid<Role>()
.Name(
"RoleGrid"
)
.Columns(columns =>
{
columns.Bound(c => c.RoleId)
.Hidden(
true
);
columns.Bound(c => c.RoleCode)
.Filterable(f => f.Extra(
false
).Operators(o => o.ForString(str => str.Clear().Contains(
"Contains"
))));
columns.Bound(c => c.RoleName);
columns.Bound(c => c.RoleDescription);
columns.Bound(c => c.RoleDisplayOrder);
})
.Filterable(filterable => filterable
.Extra(
false
)
.Operators(operators => operators
.ForString(str => str
.Clear()
.Contains(
"Contains"
)
.DoesNotContain(
"Does not contain"
)
.StartsWith(
"Starts with"
)
.EndsWith(
"Ends with"
)
.IsEqualTo(
"Is equal to"
)
.IsNotEqualTo(
"Is not equal to "
)
)
)
)
.Scrollable()
.Selectable()
.Sortable()
.Pageable(pageable => pageable
.ButtonCount(5)
.PageSizes(
new
int
[] { 5, 10, 20, 50, 100, 150, 200 })
.Input(
true
)
.Refresh(
true
)
)
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(m => m.RoleId);
model.Field(m => m.RoleId).Editable(
false
);
})
.Events(events => events
.Error(
"ajaxErrorHandlerForGrid('RoleGrid')"
)
)
.Read(read => read.Action(
"Role_Read"
,
"Shared"
))
)
)
I have tried setting the GridFilterMode to menu, but that didn't cause any change. And I'm using the latest release of Telerik.UI.for.AspNet.Core (2017.1.118), the project type is .NET Core with .NET Framework, and it is using similar code to a .NET Framework project that currently works fine. Is this functionality that is no longer supported or is there a new way to implement it that I am missing?
Thanks for the help.