7 Answers, 1 is accepted
Please take a look at this Kendo UI Dojo by Progress which illustrates how to set the filter's default operator to Contains.
Here is how filterable.cell.operator is used in this example:
columns: [
{
...
filterable: {
cell: {
operator: "contains"
}
}
},
... ]
Hope this helps!
Regards,
Patrick
Telerik
is it possible to do this in the c# razor view ? instead of jquery ?
I tried something like that, but it didnt work, didnt give me any errors though.
@(Html.Kendo().Grid<VaultLeitarvefur.Models.VaultNidurstodur>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.Verkefni).Title(VaultLeitarvefur.Models.VaultNidurstodur.Key01).Width(150).Filterable(u => u.Cell(j => j.Operator("Contains")));
Yes, you can do the same in C# Razor. Please take a look at the following demo "Filter Row" and select the .cshtml source at the bottom.
You can see the implementation being used for the ShipName column:
.Columns(columns =>
{
...
columns.Bound(p => p.ShipName).Width(500).Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")));
...
})
Also, thank you for providing your code snippet. I believe if you lowercase "contains", it should work.
Hope this helps!
Regards,
Patrick
Telerik
I copied your verison and it actually is exactly the same as mine and doesnt work.
I do have
.Filterable(f => f.Operators(m => m.ForString(n => n.IsEqualTo("Jafngilt")
.EndsWith("Lýkur með")
.IsEmpty("Er tómt")
.IsNotEmpty("Er Ekki tómt")
.IsNotEqualTo("Er ekki jafngilt")
.IsNotNull("Er ekki null")
.IsNull("Er null")
.StartsWith("Hefst með")
.Contains("Inniheldur")
.DoesNotContain("Inniheldur ekki")
)))
later in the code, but that should affect it. I tried contains and Contains it still doesnt select that item from the dropdownlists.
any ideas ?
there are no errors, just selects the first one.
Regards,
Emil
Please take a look at the attached Kendo MVC Project which illustrates how to have the contains first appear. Be sure to include Filter mode for the grid. In this case, it would be by row.
.Filterable(f => f.Mode(GridFilterMode.Row))
Regards,
Patrick
Telerik
Well done, that was what was missing. I just had .Filterable() , didnt set the mode.
Thank you
Emil
Glad to help and that your filter is working!
Regards,
Patrick
Telerik