This question is locked. New answers and comments are not allowed.
Hi,
I have encounterd an problem with Grids. I want to use OR statements with Filterable(), and I do not know how to accomplish that.
For an example. The code below use AND; I am looking for the result containing Manufacturer "Alpha" and Name "John".
But as I said, I want to use OR, see example below. Here I want the result from two Manufactures. I know that OR()-method does not exists, but I wanted to show you some psudo code what I want to accomplish.
Do you have any bright ideas to conquer this problem?
Regards,
Mario
I have encounterd an problem with Grids. I want to use OR statements with Filterable(), and I do not know how to accomplish that.
For an example. The code below use AND; I am looking for the result containing Manufacturer "Alpha" and Name "John".
<%= Html.Telerik().Grid(Model.Items) .Name("Grid") .PrefixUrlParameters(false) .Columns(columns => { columns.Bound(o => o.Id).Width(200); columns.Bound(o => o.Manufacture).Width(200); columns.Bound(o => o.Name).Width(200); columns.Bound(o => o.Price).Width(200); }) .DataBinding(dataBinding => { dataBinding.Server().Select("Index", "Home", new { ajax = true }); dataBinding.Ajax().Select("_Index", "Home").Enabled(true); }) .Scrollable(scrolling => scrolling.Enabled(true)) .Sortable(sorting => sorting.Enabled(true)) .Pageable(paging => paging.Total(Model.TotalItems).PageSize(Model.PageSize)) .Filterable(filtering => filtering.Filters(f => { /* AND STATEMENT, notice the Manucature and Name*/ f.Add(o => o.Manufacture).Contains("Alpha"); f.Add(o => o.Name).Contains("John"); })) .Groupable(grouping => grouping.Enabled(true)) .Footer(true)%>But as I said, I want to use OR, see example below. Here I want the result from two Manufactures. I know that OR()-method does not exists, but I wanted to show you some psudo code what I want to accomplish.
<%= Html.Telerik().Grid(Model.Items) .Name("Grid") .PrefixUrlParameters(false) .Columns(columns => { columns.Bound(o => o.Id).Width(200); columns.Bound(o => o.Manufacture).Width(200); columns.Bound(o => o.Name).Width(200); columns.Bound(o => o.Price).Width(200); }) .DataBinding(dataBinding => { dataBinding.Server().Select("Index", "Home", new { ajax = true }); dataBinding.Ajax().Select("_Index", "Home").Enabled(true); }) .Scrollable(scrolling => scrolling.Enabled(true)) .Sortable(sorting => sorting.Enabled(true)) .Pageable(paging => paging.Total(Model.TotalItems).PageSize(Model.PageSize)) .Filterable(filtering => filtering.Filters(f => { /* OR STATEMENT, notice the Manufacture */ f.Add(o => o.Manufacture).Contains("Alpha").OR().Contains("Beta"); })) .Groupable(grouping => grouping.Enabled(true)) .Footer(true)%>Do you have any bright ideas to conquer this problem?
Regards,
Mario