# Filter AND/OR Logic \[NEW]

By default, all filter controls, such as [Text Filter](/controls/text-filter.md), [Checkbox Filter](/controls/checkbox-path-filter.md), and so on, use AND logic. The AND logic means that the result list meets **all criteria** within a set of filter and path rules.

But it is possible to change this behavior with a **customFilter** property like this:&#x20;

{% code lineNumbers="true" %}

```javascript
datagrid({
    customFilter: `
        { location } and { place-title } and
        ({ exclusive } or { parking } or { delivery }) and
        ({ family } or { romantic } or { party })`,

    // ... any other DataGrid setting ....
});
```

{% endcode %}

{% hint style="info" %}
You can use any combination of **and**, **or**, and **parentheses**.
{% endhint %}

Each parenthesized token, such as `{ location }`, corresponds to a filter control. The value inside parentheses matches **data-id** property of the control.

There is only one exception: in the case of the [Radio Button Filter control](/controls/radio-button-path-filter.md), the **name** property is used instead of **data-id**.

{% hint style="info" %}
**data-id** may contain English letters, numbers, dashes or underscores only.
{% endhint %}

{% code title="For example:" lineNumbers="true" %}

```html
<!-- text filter control: data-id="location" -->
<input
        type="text"
        placeholder="Filter by location"
        data-grid-control="text-filter"
        data-path=".my-path-to-filter"
        data-id="location" />

<!-- radio button control uses name instead of data-id -->
<input
        type="radio"
        name="color-radio"
        data-grid-control="radio-filter"
        data-path=".color-red"
/>
```

{% endcode %}

{% hint style="info" %}
You can find working examples in the downloaded archive under **/main/6-filters-and-or-logic/**.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.getdatagrid.com/filter-and-or-logic-new.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
