# FilterBuilder

## Properties

### WriteAction - Func

## Methods

### FilterExpression(System.Action)

An object which represents a filter expression which the kendo.data.DataSource can use to filter the data.

#### Parameters

##### configurator - System.Action<[DataSourceFilterDescriptorFactory](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/datasourcefilterdescriptorfactory)>

The value for Expression

#### RETURNS

Returns the current [FilterBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/filterbuilder) instance.

#### Example

```
 
               @(Html.Kendo().Filter<ProductViewModel>()
                   .Name("filter")
                   .Fields(fields =>
                   {
                        fields.Add(field => field.ProductName).Label("ProductName");
                   })
                   .FilterExpression(expression =>
                   {
                       expression.Add(filter => filter.ProductName).IsGreaterThanOrEqualTo(5);
                   })
               )
             
```

### FilterExpression(Kendo.Mvc.CompositeFilterDescriptor)

An object which represents a filter expression which the kendo.data.DataSource can use to filter the data.

#### Parameters

##### value - [CompositeFilterDescriptor](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc/compositefilterdescriptor)

The value for Expression

#### RETURNS

Returns the current [FilterBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/filterbuilder) instance.

#### Example

```
 
                @{
            
                    FilterDescriptor filterDescriptor = FilterDescriptor()
                    {
                       Member = "ProductName",
                       CaseSensitiveFilter = true,
                       Value = "Chai",
                       MemberType = typeof(string),
                       Operator = FilterOperator.IsEqualTo
                    };
            
                    CompositeFilterDescriptor compositeFilterDescriptor = new CompositeFilterDescriptor()
                    {
                        FilterDescriptors = new FilterDescriptorCollection
                        {
                            filterDescriptor
                        },
                        CaseSensitiveFilter = true,
                        LogicalOperator = FilterCompositionLogicalOperator.Or
                    };
                }
            
            
                @(Html.Kendo().Filter<ProductViewModel>()
                    .Name("filter")
                    .Fields(fields =>
                    {
                         fields.Add(product => product.ProductName).Label("ProductName");
                    })
                    .FilterExpression(@compositeFilterDescriptor)
                )
              
```

### Operators(System.Action)

The text of the filter operators displayed in the filter.

#### Parameters

##### configurator - System.Action<[FilterOperatorsSettingsBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/filteroperatorssettingsbuilder)>

The configurator for the operators setting.

#### RETURNS

Returns the current [FilterBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/filterbuilder) instance.

#### Example

```
 
               @(Html.Kendo().Filter<ProductViewModel>()
                   .Name("filter")
                   .Fields(fields =>
                   {
                        fields.Add(field => field.ProductName).Label("ProductName");
                   })
                   .Operators(operators =>
                        {
                            operators.String(s =>
                                {
                                     s.Contains("Contains")
                                      .Startswith("Starts with")
                                      .Endswith("Ends with")
                                      .Eq("Equals")
                                      .Neq("Does not equal")
                                      .Isnull("Is null")
                                      .Isnotnull("Is not null")
                                      .Isnotempty("Is not empty")
                                      .Isnullorempty("Is null or empty")
                                      .Isnotnullorempty("Is not null or empty")
                                      .Contains("Contains")
                                      .Doesnotcontain("Does not contain");
                                }
                            );
                        }
                    )
                   .FilterExpression(filter =>
                   {
                       filter.Add(field => field.ProductName).Contains("cha");
                   })
               )
             
```

### ApplyButton(System.Boolean)

If set to true the filter will display a button which when clicked will apply filtering over the datasource.

#### Parameters

##### value - `System.Boolean`

The value for ApplyButton

#### RETURNS

Returns the current [FilterBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/filterbuilder) instance.

### ApplyButton()

If set to true the filter will display a button which when clicked will apply filtering over the datasource.

#### RETURNS

Returns the current [FilterBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/filterbuilder) instance.

### DataSource(System.String)

The data source to which the widget will apply a filter. Should be an existing kendo.data.DataSource instance.

#### Parameters

##### value - `System.String`

The value for DataSource

#### RETURNS

Returns the current [FilterBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/filterbuilder) instance.

### ExpressionPreview(System.Boolean)

If set to true the filter will visualize the filter expression that will be applied to the datasource.

#### Parameters

##### value - `System.Boolean`

The value for ExpressionPreview

#### RETURNS

Returns the current [FilterBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/filterbuilder) instance.

### ExpressionPreview()

If set to true the filter will visualize the filter expression that will be applied to the datasource.

#### RETURNS

Returns the current [FilterBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/filterbuilder) instance.

### Fields(System.Action)

The configuration of the filter fields. An array of JavaScript objects that hold information regarding the filter field, it's editor, default values used for filter and etc.

#### Parameters

##### configurator - System.Action<[FilterFieldFactory](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/filterfieldfactory)>

The configurator for the fields setting.

#### RETURNS

Returns the current instance of [FilterBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/filterbuilder) .

### MainLogic(Kendo.Mvc.FilterCompositionLogicalOperator)

Defines the value of the logical operator at the root level of the filter expression.

#### Parameters

##### value - [FilterCompositionLogicalOperator](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc/filtercompositionlogicaloperator)

The value for MainLogic

#### RETURNS

Returns the current [FilterBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/filterbuilder) instance.

### Messages(System.Action)

The text messages displayed in the filter. Use it to customize or localize the filter messages.

#### Parameters

##### configurator - System.Action<[FilterMessagesSettingsBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/filtermessagessettingsbuilder)>

The configurator for the messages setting.

#### RETURNS

Returns the current instance of [FilterBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/filterbuilder) .

### Events(System.Action)

Configures the client-side events.

#### Parameters

##### configurator - System.Action<[FilterEventBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/filtereventbuilder)>

The client events action.

#### RETURNS

Returns the current [FilterBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/filterbuilder) instance.

#### Example

```
 
            @(Html.Kendo().Filter()
                  .Name("Filter")
                  .Events(events => events
                      .Change("onChange")
                  )
            )
             
```

### ToComponent()

Returns the internal view component.

#### RETURNS

The  instance that represents the component.

### Expression(System.String)

Sets the name of the component.

#### Parameters

##### modelExpression - `System.String`

The name.

#### RETURNS

Returns the current  instance.

### Explorer(Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer)

Sets the name of the component.

#### Parameters

##### modelExplorer - `Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer`

The name.

#### RETURNS

Returns the current  instance.

### Name(System.String)

Sets the name of the component.

#### Parameters

##### componentName - `System.String`

The name.

#### RETURNS

Returns the current  instance.

### Deferred(System.Boolean)

Suppress initialization script rendering. Note that this options should be used in conjunction with Kendo.Mvc.UI.Fluent.WidgetFactory.DeferredScripts(System.Boolean,System.Boolean)

#### Parameters

##### deferred - `System.Boolean`

#### RETURNS

Returns a [DeferredWidgetBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/deferredwidgetbuilder) instance.

### HtmlAttributes(System.Object)

Sets the HTML attributes.

#### Parameters

##### attributes - `System.Object`

The HTML attributes.

#### RETURNS

Returns the current  instance.

### HtmlAttributes(System.Collections.Generic.IDictionary)

Sets the HTML attributes.

#### Parameters

##### attributes - `System.Collections.Generic.IDictionary<String,Object>`

The HTML attributes.

#### RETURNS

Returns the current  instance.

### ScriptAttributes(System.Object,System.Boolean)

Sets the JavaScript attributes to the initialization script.

#### Parameters

##### attributes - `System.Object`

The JavaScript attributes.

##### overrideAttributes - `System.Boolean`

Argument which determines whether attributes should be overriden.

#### RETURNS

Returns the current  instance.

### ScriptAttributes(System.Collections.Generic.IDictionary,System.Boolean)

Sets the JavaScript attributes to the initialization script.

#### Parameters

##### attributes - `System.Collections.Generic.IDictionary<String,Object>`

The JavaScript attributes.

##### overrideAttributes - `System.Boolean`

Argument which determines whether attributes should be overriden.

#### RETURNS

Returns the current  instance.

### Render()

Renders the component in place.

### ToHtmlString()

Returns the HTML representation of the component.

### WriteTo(System.IO.TextWriter,System.Text.Encodings.Web.HtmlEncoder)

#### Parameters

##### writer - `System.IO.TextWriter`

##### encoder - `System.Text.Encodings.Web.HtmlEncoder`

### ToClientTemplate()

Returns the client template for the component.

### AsModule(System.Boolean)

Specifies whether the initialization script of the component will be rendered as a JavaScript module.

#### Parameters

##### value - `System.Boolean`

#### RETURNS

Returns the current  instance.
