This is a migrated thread and some comments may be shown as answers.

Grid - Filter - Standard Drop down first actual filtered results

6 Answers 96 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 14 Feb 2020, 03:59 PM

Please correct me if I am wrong.   When we try to search in the Name field (without tabbing out), a drop down appears, but only appears to use StartsWith.  While when you tab out, the filtering actually uses the filter operator.

Other than wiring up a filter template to a combobox and then wire up to the "Operator button" (change event) make sure the Grid Filter operator matches the Combobox operator, is there anything else I can do?

Thanks

Sample code below: 

                    @(Html
                .Kendo()
                    .Grid<ItemViewDisplay>()
                        .Name("saleItemSearchGrid")
                        .Columns(columns =>
                        {
                            columns.Bound(c => c.ItemCostId).Hidden(true);
                            // Name:
                            columns.Bound(c => c.Name).Filterable(KendoConstants.Grid.FilterConfigs.ContainsOperator);
                            // IngredientNumber:
                            columns.Bound(c => c.IngredientNumber).Filterable(KendoConstants.Grid.FilterConfigs.ContainsOperator);
                            // BarcodeCount:
                            columns.Bound(c => c.BarcodeDisplayList).Filterable(f => f.Cell(cell => cell.Operator("contains").Delay(1500)))
                       .ClientTemplate("#=BarcodeDisplayStr#");
                            columns.Command(command => { command.Custom("gridSelect").Text("Select").Click("jsSaleItemSelected"); }).Title("Action");
                        })
                        .HtmlAttributes(KendoConstants.Grid.StandardHtmlAttributes)
                        .Scrollable()
                        .Sortable()
                        .PersistSelection()
                        .Filterable(KendoConstants.Grid.FilterByRow)
                        .Pageable(KendoConstants.Grid.Paging5Button)
                        .DataSource(dataSource => dataSource
                            .Ajax()
                            .Events(KendoConstants.StandardErrorFunction)
                            .Model(model => model.Id(p => p.ItemCostId))
                            .Read(read => read.Action("MenuButtonItemList_Read", "Menu"))
                            .PageSize(KendoConstants.Grid.StandardPageSize)
                        )
                    )

6 Answers, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 18 Feb 2020, 01:47 PM

Hi Peter,

If you want to only change the operator in the dropdown you can use the SuggestionOperator as shown below.

columns.Bound(p => p.ShipName).Filterable(ftb => ftb.Cell(cell => cell.SuggestionOperator(FilterType.Contains))).Width(500);

With the above approach there is no need to create a custom filter control to replace the default one.

Regards,
Angel Petrov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Peter
Top achievements
Rank 1
answered on 18 Feb 2020, 01:52 PM
That applies to the Filter in the grid, I am referring to the drop down that appears before the change event in the filter box is triggered and the grid is updated.
0
Peter
Top achievements
Rank 1
answered on 18 Feb 2020, 01:55 PM
See the sample
0
Angel Petrov
Telerik team
answered on 20 Feb 2020, 11:42 AM

Hi Peter,

Actually the SuggestionOperator is related to the dropdown. The cell operator is related to the grid. Here is a configuration demonstrating both of them.

columns.Bound(p => p.ShipName).Filterable(ftb => ftb.Cell(cell => cell.Operator("endswith").SuggestionOperator(FilterType.Contains)));

Regards,
Angel Petrov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Peter
Top achievements
Rank 1
answered on 20 Feb 2020, 11:49 AM
Thanks for that clarification, is there anyway to keep the drop down and grid filter operators in sync?
0
Angel Petrov
Telerik team
answered on 24 Feb 2020, 11:34 AM

Hello Peter,

By in sync I suppose that you mean to use equal operators. Currently this is achievable only if the operators are Contains and StartsWith as the SuggestionOperator can be set to one of the aforementioned. If the requirement is to have all the operations listed I suggest opening a feature request.

Regards,
Angel Petrov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Peter
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Peter
Top achievements
Rank 1
Share this question
or