# GC.Spread.Sheets.Filter.RowFilterBase

## Content

# Class: RowFilterBase

[Sheets](../modules/GC.Spread.Sheets).[Filter](../modules/GC.Spread.Sheets.Filter).RowFilterBase

## Hierarchy

- **`RowFilterBase`**

  ↳ [`HideRowFilter`](GC.Spread.Sheets.Filter.HideRowFilter)

## Table of contents

### Constructors

- [constructor](GC.Spread.Sheets.Filter.RowFilterBase#constructor)

### Properties

- [extendedRange](GC.Spread.Sheets.Filter.RowFilterBase#extendedrange)
- [range](GC.Spread.Sheets.Filter.RowFilterBase#range)
- [typeName](GC.Spread.Sheets.Filter.RowFilterBase#typename)

### Methods

- [addFilterItem](GC.Spread.Sheets.Filter.RowFilterBase#addfilteritem)
- [filter](GC.Spread.Sheets.Filter.RowFilterBase#filter)
- [filterButtonVisible](GC.Spread.Sheets.Filter.RowFilterBase#filterbuttonvisible)
- [fromJSON](GC.Spread.Sheets.Filter.RowFilterBase#fromjson)
- [getFilterItems](GC.Spread.Sheets.Filter.RowFilterBase#getfilteritems)
- [getFilteredItems](GC.Spread.Sheets.Filter.RowFilterBase#getfiltereditems)
- [getSortState](GC.Spread.Sheets.Filter.RowFilterBase#getsortstate)
- [isFiltered](GC.Spread.Sheets.Filter.RowFilterBase#isfiltered)
- [isRowFilteredOut](GC.Spread.Sheets.Filter.RowFilterBase#isrowfilteredout)
- [onFilter](GC.Spread.Sheets.Filter.RowFilterBase#onfilter)
- [openFilterDialog](GC.Spread.Sheets.Filter.RowFilterBase#openfilterdialog)
- [removeFilterItems](GC.Spread.Sheets.Filter.RowFilterBase#removefilteritems)
- [reset](GC.Spread.Sheets.Filter.RowFilterBase#reset)
- [sortColumn](GC.Spread.Sheets.Filter.RowFilterBase#sortcolumn)
- [toJSON](GC.Spread.Sheets.Filter.RowFilterBase#tojson)
- [unfilter](GC.Spread.Sheets.Filter.RowFilterBase#unfilter)

## Constructors

### <a id="constructor" name="constructor"></a> constructor

• **new RowFilterBase**(`range?`)

Represents a row filter base that supports row filters for filtering rows in a sheet.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `range?` | [`Range`](GC.Spread.Sheets.Range) | The filter range. |

## Properties

### <a id="extendedrange" name="extendedrange"></a> extendedRange

• **extendedRange**: [`Range`](GC.Spread.Sheets.Range)

Represents the extendedRange for the row filter.

___

### <a id="range" name="range"></a> range

• **range**: [`Range`](GC.Spread.Sheets.Range)

Represents the range for the row filter.

___

### <a id="typename" name="typename"></a> typeName

• **typeName**: `string`

Represents the type name string used for supporting serialization.

## Methods

### <a id="addfilteritem" name="addfilteritem"></a> addFilterItem

▸ **addFilterItem**(`col`, `condition`): `void`

Adds a specified filter to the row filter.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `col` | `number` | The column index. |
| `condition` | [`Condition`](GC.Spread.Sheets.ConditionalFormatting.Condition) | The condition to filter. |

#### Returns

`void`

___

### <a id="filter" name="filter"></a> filter

▸ **filter**(`col?`): `void`

Filters the specified column.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `col?` | `number` | The index of the column to be filtered; if it is omitted, all the columns in the range will be filtered. |

#### Returns

`void`

___

### <a id="filterbuttonvisible" name="filterbuttonvisible"></a> filterButtonVisible

▸ **filterButtonVisible**(`col?`, `value?`): `any`

Gets or sets whether the sheet column's filter button is displayed.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `col?` | `number` | The column index of the filter button. |
| `value?` | `boolean` | Whether the filter button is displayed. |

#### Returns

`any`

     No parameter `false` if all filter buttons are invisible; otherwise, `true`.
     One parameter col `false` if the specified column filter button is invisible; otherwise, `true`.
     One parameter value <c>GC.Spread.Sheets.Filter.RowFilterBase</c> sets all filter buttons to be visible(true)/invisible(false).
     Two parameters col,value <c>GC.Spread.Sheets.Filter.RowFilterBase</c> sets the specified column filter button to be visible(true)/invisible(false).

___

### <a id="fromjson" name="fromjson"></a> fromJSON

▸ **fromJSON**(`settings`): `void`

Loads the object state from the specified JSON string.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `settings` | `Object` | The row filter data from deserialization. |

#### Returns

`void`

___

### <a id="getfilteritems" name="getfilteritems"></a> getFilterItems

▸ **getFilterItems**(`col`): [`Condition`](GC.Spread.Sheets.ConditionalFormatting.Condition)[]

Gets the filters for the specified column.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `col` | `number` | The column index. |

#### Returns

[`Condition`](GC.Spread.Sheets.ConditionalFormatting.Condition)[]

Returns a collection that contains conditions that belong to a specified column.

___

### <a id="getfiltereditems" name="getfiltereditems"></a> getFilteredItems

▸ **getFilteredItems**(): [`Condition`](GC.Spread.Sheets.ConditionalFormatting.Condition)[]

Gets all the filtered conditions.

#### Returns

[`Condition`](GC.Spread.Sheets.ConditionalFormatting.Condition)[]

Returns a collection that contains all the filtered conditions.

___

### <a id="getsortstate" name="getsortstate"></a> getSortState

▸ **getSortState**(`col`): [`SortState`](../enums/GC.Spread.Sheets.SortState)

Gets the current sort state.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `col` | `number` | The column index. |

#### Returns

[`SortState`](../enums/GC.Spread.Sheets.SortState)

The sort state of the current filter.

___

### <a id="isfiltered" name="isfiltered"></a> isFiltered

▸ **isFiltered**(`col?`): `boolean`

Gets a value that indicates whether any row or specified column is filtered.

**`example`**
```
//This example uses the isFiltered method.
activeSheet.setValue(0, 0, "North");
activeSheet.setValue(1, 0, "South");
activeSheet.setValue(2, 0, "East");
activeSheet.setValue(3, 0, "South");
activeSheet.setValue(4, 0, "North");
activeSheet.setValue(5, 0, "North");
activeSheet.setValue(6, 0, "West");
activeSheet.setColumnWidth(0, 80);
//Set a row filter.
activeSheet.rowFilter(new GC.Spread.Sheets.Filter.HideRowFilter(new GC.Spread.Sheets.Range(0, 0, 7, 1)));
//button
$("#button1").click(function () {
    var rowFilter = spread.getActiveSheet().rowFilter();
    if (rowFilter.isFiltered(0)) {
        alert("Row-filtering executed for Column1");
    } else {
        alert("Row-filtering not executed for Column1");
    }
});
//Add button control to page
&lt;input type="button" id="button1" value="button1"/&gt;
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `col?` | `number` | The column index. |

#### Returns

`boolean`

No parameter `true` if some rows are filtered; otherwise, `false`.
                    One parameter col `true` if the specified column is filtered; otherwise, `false`.

___

### <a id="isrowfilteredout" name="isrowfilteredout"></a> isRowFilteredOut

▸ **isRowFilteredOut**(`row`): `boolean`

Determines whether the specified row is filtered out.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `row` | `number` | The row index. |

#### Returns

`boolean`

`true` if the row is filtered out; otherwise, `false`.

___

### <a id="onfilter" name="onfilter"></a> onFilter

▸ **onFilter**(`args`): `void`

Performs the action when some columns have just been filtered or unfiltered.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `args` | [`IFilteredArgs`](../interfaces/GC.Spread.Sheets.Filter.IFilteredArgs) | An object that contains the <i>action</i>, <i>sheet</i>, <i>range</i>, <i>filteredRows</i>, and <i>filteredOutRows</i>. See the Remarks for additional information. |

#### Returns

`void`

___

### <a id="openfilterdialog" name="openfilterdialog"></a> openFilterDialog

▸ **openFilterDialog**(`filterButtonHitInfo`): `void`

Opens the filter dialog when the user clicks the filter button.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `filterButtonHitInfo` | [`IFilterButtonHitInfo`](../interfaces/GC.Spread.Sheets.IFilterButtonHitInfo) | The hit test information about the filter button. |

#### Returns

`void`

___

### <a id="removefilteritems" name="removefilteritems"></a> removeFilterItems

▸ **removeFilterItems**(`col`): `void`

Removes the specified filter.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `col` | `number` | The column index. |

#### Returns

`void`

___

### <a id="reset" name="reset"></a> reset

▸ **reset**(): `void`

Clears all filters.

#### Returns

`void`

___

### <a id="sortcolumn" name="sortcolumn"></a> sortColumn

▸ **sortColumn**(`col`, `ascending`): `void`

Sorts the specified column in the specified order.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `col` | `number` | The column index. |
| `ascending` | `boolean` | Set to `true` to sort as ascending. |

#### Returns

`void`

___

### <a id="tojson" name="tojson"></a> toJSON

▸ **toJSON**(): `Object`

Saves the object state to a JSON string.

#### Returns

`Object`

The row filter data.

___

### <a id="unfilter" name="unfilter"></a> unfilter

▸ **unfilter**(`col?`): `void`

Removes the filter from the specified column.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `col?` | `number` | The index of the column for which to remove the filter; if it is omitted, removes the filter for all columns in the range. |

#### Returns

`void`
