{/* Do not edit this file. It is automatically generated by API Documenter. */}


## LocalDataProvider

LocalDataProvider class. Inherits [DataProviderBase](/refs/Class/DataProviderBase).

**Signature:**

```typescript
export declare class LocalDataProvider extends DataProviderBase
```
**Extends:** [DataProviderBase](/refs/Class/DataProviderBase)

## Remarks

\[Superclass\]

[DataProviderBase](/refs/Class/DataProviderBase)

## Events

| Property | Type | Description |
| --- | --- | --- |
| [onDataChanged](/refs/Class/LocalDataProvider#ondatachanged) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}) =&gt; void | A callback notifying that the value of the data set has changed |
| [onRestoreRows](/refs/Class/LocalDataProvider#onrestorerows) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, rows: number\[\]) =&gt; void | A callback indicating that the state of multiple data rows has been restored |
| [onRowCountChanged](/refs/Class/LocalDataProvider#onrowcountchanged) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, newCount: number) =&gt; void | A callback notifying that the number of data rows has changed |
| [onRowDeleted](/refs/Class/LocalDataProvider#onrowdeleted) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number) =&gt; void | A callback indicating that a row of data has been deleted |
| [onRowDeleting](/refs/Class/LocalDataProvider#onrowdeleting) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number) =&gt; boolean | A callback that determines deletion of a data row |
| [onRowInserted](/refs/Class/LocalDataProvider#onrowinserted) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number) =&gt; void | A callback notifying that a row of data has been added |
| [onRowInserting](/refs/Class/LocalDataProvider#onrowinserting) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number, values: [DataValues](/refs/realgrid#datavalues){/* */}) =&gt; boolean | A callback that determines whether to add a row of data |
| [onRowListMoved](/refs/Class/LocalDataProvider#onrowlistmoved) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, rows: number\[\], newRow: number) =&gt; void | A callback indicating that multiple rows of data have been moved |
| [onRowListMoving](/refs/Class/LocalDataProvider#onrowlistmoving) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, rows: number\[\], newRow: number) =&gt; boolean | Callback that determines row movement using the mouse |
| [onRowListUpdated](/refs/Class/LocalDataProvider#onrowlistupdated) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, rows: number\[\]) =&gt; void | A callback to indicate that multiple rows of data have changed |
| [onRowMoved](/refs/Class/LocalDataProvider#onrowmoved) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number, newRow: number) =&gt; void | A callback indicating that a row of data has been moved |
| [onRowMoving](/refs/Class/LocalDataProvider#onrowmoving) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number, newRow: number) =&gt; boolean | A callback that determines the movement of a row of data |
| [onRowsDeleted](/refs/Class/LocalDataProvider#onrowsdeleted) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, rows: number\[\]) =&gt; void | A callback indicating that a row of data has been deleted |
| [onRowsInserted](/refs/Class/LocalDataProvider#onrowsinserted) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number, count: number) =&gt; void | A callback to notify when multiple data rows are added in batches |
| [onRowsMoved](/refs/Class/LocalDataProvider#onrowsmoved) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number, count: number, newRow: number) =&gt; void | A callback indicating that multiple rows of data have been moved |
| [onRowsMoving](/refs/Class/LocalDataProvider#onrowsmoving) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number, count: number, newRow: number) =&gt; boolean | A callback that determines the movement of multiple data rows |
| [onRowStateChanged](/refs/Class/LocalDataProvider#onrowstatechanged) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number) =&gt; void | A callback notifying that the state of a data row has changed |
| [onRowStatesChanged](/refs/Class/LocalDataProvider#onrowstateschanged) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, rows: number\[\]) =&gt; void | Callback notifying that the status of multiple data rows has been changed at once |
| [onRowStatesCleared](/refs/Class/LocalDataProvider#onrowstatescleared) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}) =&gt; void | A callback indicating that the status of all rows has been initialized |
| [onRowsUpdated](/refs/Class/LocalDataProvider#onrowsupdated) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number, count: number) =&gt; void | A callback notifying that multiple data rows have been modified in batches |
| [onRowUpdated](/refs/Class/LocalDataProvider#onrowupdated) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number) =&gt; void | A callback notifying that a row of data has been modified |
| [onRowUpdating](/refs/Class/LocalDataProvider#onrowupdating) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number, oldValues: [RowValues](/refs/realgrid#rowvalues){/* */}, newValues: [RowValues](/refs/realgrid#rowvalues){/* */}) =&gt; boolean | Callback that determines whether a data row has been modified |
| [onValueChanged](/refs/Class/LocalDataProvider#onvaluechanged) | (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number, field: number) =&gt; void | A callback notifying that the value of a data cell has changed |

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [rowCount](/refs/Class/LocalDataProvider#rowcount) | number | Reads or sets rowCount. For setting, see [LocalDataProvider.setRowCount()](/refs/Class/LocalDataProvider#setrowcount). |

## Methods

| Method | Type | Description |
| --- | --- | --- |
| [addRow(values)](/refs/Class/LocalDataProvider#addrow) | addRow(values: [DataValues](/refs/realgrid#datavalues){/* */}): number; | Add a row of data |
| [addRows(rows, start, count, rowEvents)](/refs/Class/LocalDataProvider#addrows) | addRows(rows: [DataValues](/refs/realgrid#datavalues){/* */}\[\], start?: number, count?: number, rowEvents?: boolean): void; | Get it from the data source and add it to the data set. |
| [clearRows()](/refs/Class/LocalDataProvider#clearrows) | clearRows(): void; | Initialize data set |
| [fillCsvData(data, options)](/refs/Class/LocalDataProvider#fillcsvdata) | fillCsvData(data: any, options?: [DataFillOptions](/refs/Interface/DataFillOptions){/* */}): void; | Create a data set by parsing strings from the CSV data source. |
| [fillJsonData(data, options)](/refs/Class/LocalDataProvider#filljsondata) | fillJsonData(data: any, options?: [DataFillOptions](/refs/Interface/DataFillOptions){/* */}): void; | Create a data set by importing data from a JSON data source. |
| [fillXmlData(data, options)](/refs/Class/LocalDataProvider#fillxmldata) | fillXmlData(data: any, options?: [DataFillOptions](/refs/Interface/DataFillOptions){/* */}): void; | Create a data set by parsing a string from an XML data source. |
| [getFieldValues(field, startRow, endRow)](/refs/Class/LocalDataProvider#getfieldvalues) | getFieldValues(field: number \| string, startRow?: number, endRow?: number): any\[\]; | Returns data from a specific section corresponding to a specific field in the data set. |
| [getHiddenRows()](/refs/Class/LocalDataProvider#gethiddenrows) | getHiddenRows(): number\[\]; | Returns the indices of hidden data rows. |
| [getJsonRow(row, rowState)](/refs/Class/LocalDataProvider#getjsonrow) | getJsonRow(row: number, rowState?: boolean): [RowObject](/refs/realgrid#rowobject){/* */}; | Converts the value of the specified data row to Object type. |
| [getJsonRows(startRow, endRow, rowState)](/refs/Class/LocalDataProvider#getjsonrows) | getJsonRows(startRow?: number, endRow?: number, rowState?: boolean): object\[\]; | Returns data from a specific section of the data set as an Object array. |
| [getOutputRow(options, row)](/refs/Class/LocalDataProvider#getoutputrow) | getOutputRow(options: [DataOutputOptions](/refs/Interface/DataOutputOptions){/* */}, row: number): object; | A specific data row in the data set is returned as an Object according to the settings. |
| [getOutputRows(options, startRow, endRow)](/refs/Class/LocalDataProvider#getoutputrows) | getOutputRows(options: [DataOutputOptions](/refs/Interface/DataOutputOptions){/* */}, startRow?: number, endRow?: number): object\[\]; | Data from a specific section of the data set is returned as an Object array according to the settings. |
| [getRowCount()](/refs/Class/LocalDataProvider#getrowcount) | getRowCount(): number; | Returns the number of data items in the data set. |
| [getRows(startRow, endRow)](/refs/Class/LocalDataProvider#getrows) | getRows(startRow?: number, endRow?: number): [RowValues](/refs/realgrid#rowvalues){/* */}\[\]; | Returns data from a specific section of the data set as a two-dimensional array. |
| [getValue(row, field)](/refs/Class/LocalDataProvider#getvalue) | getValue(row: number, field: number \| string): any; | Returns the value of a specific field in a specific data row. |
| [hideRows(dataRows)](/refs/Class/LocalDataProvider#hiderows) | hideRows(dataRows: number\[\] \| number): void; | Used to hide specific rows from the View. |
| [insertRow(row, values)](/refs/Class/LocalDataProvider#insertrow) | insertRow(row: number, values: [DataValues](/refs/realgrid#datavalues){/* */}): boolean; | Insert a row of data at a specific location |
| [insertRows(row, rows, start, count, rowEvents)](/refs/Class/LocalDataProvider#insertrows) | insertRows(row: number, rows: [DataValues](/refs/realgrid#datavalues){/* */}\[\], start?: number, count?: number, rowEvents?: boolean): void; | It is retrieved from a data source and inserted into a specific location in the data set. |
| [isHiddenRow(dataRow)](/refs/Class/LocalDataProvider#ishiddenrow) | isHiddenRow(dataRow: number): boolean; | Returns whether a specific row is hidden. |
| [moveRow(row, newRow)](/refs/Class/LocalDataProvider#moverow) | moveRow(row: number, newRow: number): void; | Move specific data row |
| [moveRows(row, count, newRow)](/refs/Class/LocalDataProvider#moverows) | moveRows(row: number, count: number, newRow: number): void; | Move multiple data rows. |
| [removeRow(row)](/refs/Class/LocalDataProvider#removerow) | removeRow(row: number): void; | Remove data row at a specific location |
| [removeRows(rows, rowEvents)](/refs/Class/LocalDataProvider#removerows) | removeRows(rows: number\[\], rowEvents?: boolean): void; | Removes multiple data rows at a specific location. |
| [resetHiddenRows()](/refs/Class/LocalDataProvider#resethiddenrows) | resetHiddenRows(): void; | Initializes the hidden state of all rows. |
| [searchData(options)](/refs/Class/LocalDataProvider#searchdata) | searchData(options: [SearchCellOptions](/refs/Interface/SearchCellOptions){/* */}): [SearchCellResult](/refs/Interface/SearchCellResult){/* */}; | Finds cells with a specific value depending on how the search is set up. |
| [searchDataRow(options)](/refs/Class/LocalDataProvider#searchdatarow) | searchDataRow(options: [SearchOptions](/refs/Interface/SearchOptions){/* */}): number; | Depending on how the search is set up, it finds rows with a specific value. |
| [setFilterMode(filterMode)](/refs/Class/LocalDataProvider#setfiltermode) | setFilterMode(filterMode?: string): void; | Set operation conditions between filters. |
| [setFilters(filters, filterMode)](/refs/Class/LocalDataProvider#setfilters) | setFilters(filters: [DataFilters](/refs/realgrid#datafilters){/* */}, filterMode?: string): void; | Filter data from a data set. |
| [setRowCount(newCount, fillFieldDefaults, defaultValues, rowState)](/refs/Class/LocalDataProvider#setrowcount) | setRowCount(newCount: number, fillFieldDefaults?: boolean, defaultValues?: [DataValues](/refs/realgrid#datavalues){/* */}, rowState?: [RowState](/refs/realgrid#rowstate){/* */}): void; | Set the number of data items in the data set. |
| [setRows(rows, start, count)](/refs/Class/LocalDataProvider#setrows) | setRows(rows: [DataValues](/refs/realgrid#datavalues){/* */}\[\], start?: number, count?: number): void; | Populate the data set by pulling from a data source. |
| [setValue(row, field, newValue)](/refs/Class/LocalDataProvider#setvalue) | setValue(row: number, field: number \| string, newValue: any): void; | Change the value of a specific field in a specific data row. |
| [showHiddenRows(dataRows)](/refs/Class/LocalDataProvider#showhiddenrows) | showHiddenRows(dataRows: number\[\] \| number): void; | Redisplays hidden data rows. |
| [updateRow(row, values, strict)](/refs/Class/LocalDataProvider#updaterow) | updateRow(row: number, values: [DataValues](/refs/realgrid#datavalues){/* */}, strict?: boolean): void; | Changes the value of a specific data row in a data set. |
| [updateRows(row, rows, start, count, strict, rowEvents)](/refs/Class/LocalDataProvider#updaterows) | updateRows(row: number, rows: [DataValues](/refs/realgrid#datavalues){/* */}\[\], start?: number, count?: number, strict?: boolean, rowEvents?: boolean) :void; | Retrieves data from a data source and changes it to a specific location in the data set. |
| [updateRowsByDataRow(rows, strict, rowEvents)](/refs/Class/LocalDataProvider#updaterowsbydatarow) | updateRowsByDataRow(rows: \{ \[key: number\]: [DataValues](/refs/realgrid#datavalues){/* */}; \}, strict?: boolean, rowEvents?: boolean): void; | Batch edit non-consecutive rows. |

## Events Desc

### onDataChanged

Callback notifying that the value of the data set has changed

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}) =&gt; void

**Remarks:**

[setValue()](/refs/Class/LocalDataProvider#setvalue) Occurs when the value is changed by input from the function or View.

\[Parameter list\]

`provider` - DataProvider control

**Example:**


```js
dataProvider.onDataChanged = function (provider) {
 console.log('dataChanged!');
};
```

<hr/>

### onRestoreRows

A callback indicating that the state of multiple data rows has been restored.

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, rows: number\[\]) =&gt; void

**Remarks:**

Occurs when rows modified through the [restoreUpdatedRows()](/refs/Class/DataProviderBase#restoreupdatedrows) function are restored.

\[Parameter list\]

`provider` - DataProvider control

`rows` - indexed array of restored data rows

**Example:**


```js
dataProvider.onRestoreRows = function (provider, rows) {
 console.log('dataProvider row restored: ' + rows.join(', '));
};
```

<hr/>

### onRowCountChanged

A callback notifying that the number of rows of data has changed.

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, newCount: number) =&gt; void

**Remarks:**

Called when the number of data rows changes due to addition or deletion of rows, etc.

\[Parameter list\]

`provider` - DataProvider control

`newCount` - Total number of data rows after change

**Example:**


```js
dataProvider.onRowCountChanged = function (provider, newCount) {
 console.log("DataProvider rowCount changed as: " + newCount);
};
```

<hr/>

### onRowDeleted

A callback notifying that a row of data has been deleted

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number) =&gt; void

**Remarks:**

[onRowDeleting](/refs/Class/LocalDataProvider#onrowdeleting) Occurs after the callback function returns `true`{/* */} and a row is added.

\[Parameter list\]

`provider` - DataProvider control

`row` - index of the deleted data row

**Example:**


```js
dataProvider.onRowDeleted = function (provider, row) {
 console.log('dataProvider row deleted: ' + row);
};
```

<hr/>

### onRowDeleting

A callback that determines deletion of a row of data

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number) =&gt; boolean

**Remarks:**

Called just before a data row is deleted to check whether the row has been deleted. [onRowDeleted](/refs/Class/LocalDataProvider#onrowdeleted) occurs after deletion of the row is completed.

If a function is not bound to an event, it returns `true`{/* */} by default.

\[Parameter list\]

`provider` - DataProvider control

`row` - Index of the data row to be added

**Example:**


```js
dataProvider.onRowDeleting = function (provider, row) {
 if (row < 100) {
 return false;
 }
 return true;
};
```

<hr/>

### onRowInserted

Callback to notify when a row of data has been added

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number) =&gt; void

**Remarks:**

Occurs after the [onRowInserting](/refs/Class/LocalDataProvider#onrowinserting) callback returns `true`{/* */} and the row has been added.

\[Parameter list\]

`provider` - DataProvider control

`row` - Index of the added data row

**Example:**


```js
dataProvider.onRowInserted = function (provider, row) {
 console.log("DataProvider row inserted!");
};
```

<hr/>

### onRowInserting

A callback that determines whether to add a row of data.

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number, values: [DataValues](/refs/realgrid#datavalues){/* */}) = &gt; boolean

**Remarks:**

Called just before a data row is added to check whether the row has been added. [onRowInserted](/refs/Class/LocalDataProvider#onrowinserted){/* */} occurs after the modification of the row is completed.

If a function is not bound to an event, it returns `true`{/* */} by default.

\[Parameter list\]

`provider` - DataProvider control

`row` - Index of the data row to be added

`values` - Data values to be added, format [DataValues](/refs/realgrid#datavalues)

**Example:**


```js
dataProvider.onRowInserting = function (provider, row, values) {
 if (row > 100) {
 return false;
 }
 return true;
};
```

<hr/>

### onRowListMoved

Callback notifying that multiple rows of data have been moved

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, rows: number\[\], newRow: number) =&gt; void

**Remarks:**

[onRowListMoving](/refs/Class/LocalDataProvider#onrowlistmoving) Occurs after `true`{/* */} is returned from the callback function and the rows are moved.

\[Parameter list\]

`provider` - DataProvider control

`rows` - array of moved row indices

`newRow` - The index after moving the first data row

**Example:**


```js
dataProvider.onRowListMoved = function (provider, rows, newRow) {
 console.log('DataProvider ' + rows.length + ' rows moved!');
};
```

<hr/>

### onRowListMoving

Callback that determines row movement using the mouse

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, rows: number\[\], newRow: number) =&gt; boolean

**Remarks:**

It is called right before multiple data rows are moved to determine whether the rows will be moved. [onRowListMoved](/refs/Class/LocalDataProvider#onrowlistmoved) occurs after the rows are moved.

\[Parameter list\]

`provider` - DataProvider control

`rows` - array of row indices to be moved

`newRow` - The index after moving the first data row

**Example:**


```js
dataProvider.onRowListMoving = function (provider, rows, newRow) {
 return rows.length === 1)
};
```

<hr/>

### onRowListUpdated

Callback to notify that multiple rows of data have changed

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, rows: number\[\]) =&gt; void

**Remarks:**

\[Parameter list\]

`provider` - DataProvider control

`rows` - Index of changed data rows

**Example:**


```js
dataProvider.onRowListUpdated = function (provider, rows) {
 console.log("DataProvider rows updated: " + rows.join(', '));
};
```

<hr/>

### onRowMoved

A callback notifying that a row of data has been moved

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number, newRow: number) =&gt; void

**Remarks:**

[onRowMoving](/refs/Class/LocalDataProvider#onrowmoving) Occurs after `true`{/* */} is returned from the callback function and the row is moved.

\[Parameter list\]

`provider` - DataProvider control

`row` - the original index of the data row

`newRow` - Index after moving the data row

**Example:**


```js
dataProvider.onRowMoved = function (provider, row, newRow) {
 console.log('DataProvider row moved from ' + row + ' to ' + newRow);
};
```

<hr/>

### onRowMoving

A callback that determines the movement of a row of data

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number, newRow: number) =&gt; boolean

**Remarks:**

It is called right before the data row is moved to determine whether the row will be moved. [onRowMoved](/refs/Class/LocalDataProvider#onrowmoved) occurs after the row movement is complete.

\[Parameter list\]

`provider` - DataProvider control

`row` - the original index of the data row

`newRow` - Index after moving the data row

**Example:**


```js
dataProvider.onRowMoving = function (provider, row, newRow) {
 if (row < newRow) {
 return false;
 }
 return true;
};
```

<hr/>

### onRowsDeleted

A callback notifying that a row of data has been deleted

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, rows: number\[\]) =&gt; void

**Remarks:**

[onRowDeleting](/refs/Class/LocalDataProvider#onrowdeleting) Occurs after the callback function returns `true`{/* */} and a row is added.

\[Parameter list\]

`provider` - DataProvider control

`row` - index of the deleted data row

**Example:**


```js
dataProvider.onRowsDeleted = function (provider, rows) {
 console.log('DataProvider rows deleted: ' + rows.join(', '));
};
```

<hr/>

### onRowsInserted

Callback to notify when multiple data rows are added in batches

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number, count: number) =&gt; void

**Remarks:**

This occurs when events are collectively reflected in functions such as [LocalDataProvider.insertRows()](/refs/Class/LocalDataProvider#insertrows).

\[Parameter list\]

`provider` - DataProvider control

`row` - Index of the starting data row that was changed

`count` - Number of changed rows

**Example:**


```js
dataProvider.onRowsInserted = function (provider, row, count) {
 console.log("DataProvider " + count + " rows inserted!");
};
```

<hr/>

### onRowsMoved

Callback notifying that multiple rows of data have been moved

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number, count: number, newRow: number) =&gt; void

**Remarks:**

[onRowsMoving](/refs/Class/LocalDataProvider#onrowsmoving) Occurs after the callback function returns `true`{/* */} and the rows are moved.

\[Parameter list\]

`provider` - DataProvider control

`row` - the original index of the first data row

`count` - Number of rows of data to move

`newRow` - The index after moving the first data row

**Example:**


```js
dataProvider.onRowsMoved = function (provider, row, count, newRow) {
 console.log('DataProvider ' + count + ' rows moved!');
};
```

<hr/>

### onRowsMoving

A callback that determines the movement of multiple data rows

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number, count: number, newRow: number) =&gt; boolean

**Remarks:**

It is called right before multiple data rows are moved to determine whether the rows will be moved. [onRowsMoved](/refs/Class/LocalDataProvider#onrowsmoved) occurs after the rows are moved.

\[Parameter list\]

`provider` - DataProvider control

`row` - the original index of the first data row

`count` - Number of rows of data to move

`newRow` - The index after moving the first data row

**Example:**


```js
dataProvider.onRowsMoving = function (provider, row, count, newRow) {
 if (row < newRow || count > 20) {
 return false;
 }
 return true;
};
```

<hr/>

### onRowStateChanged

A callback notifying that the state of a data row has changed

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number) =&gt; void

**Remarks:**

Occurs when the status of a data row changes. However, when adding a row, the status cannot be said to have changed, so this is an exception.

\[Parameter list\]

`provider` - DataProvider control

`row` - Index of the data row whose state changed

**Example:**


```js
dataProvider.onRowStateChanged = function (provider, row) {
 console.log('dataProvider row state changed: ' + row);
};
```

<hr/>

### onRowStatesChanged

Callback notifying that the status of multiple data rows has changed at once

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, rows: number\[\]) =&gt; void

**Remarks:**

Occurs when the status of multiple data rows is changed at once. However, when adding a row, the status cannot be said to have changed, so this is an exception.

\[Parameter list\]

`provider` - DataProvider control

`rows` - Indexed array of data rows whose state has changed.

**Example:**


```js
dataProvider.onRowStatesChanged = function (provider, rows) {
 console.log('dataProvider row state changed: ' + rows.join(','));
};
```

<hr/>

### onRowStatesCleared

Callback notifying that the state of all rows has been initialized

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}) =&gt; void

**Remarks:**

Occurs after all row states have been initialized via [DataProviderBase.clearRowStates()](/refs/Class/DataProviderBase#clearrowstates)

\[Parameter list\]

`provider` - DataProvider control

**Example:**


```js
dataProvider.onRowStatesCleared = function (provider) {
 console.log('dataProvider row state cleared!');
};
```

<hr/>

### onRowsUpdated

Callback notifying that multiple data rows have been modified in batches

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number, count: number) =&gt; void

**Remarks:**

This occurs when events are collectively reflected in functions such as [updateRows](/refs/Class/LocalDataProvider#updaterows).

\[Parameter list\]

`provider` - DataProvider control

`row` - Index of the starting data row that was changed

`count` - Number of changed rows

**Example:**


```js
dataProvider.onRowsUpdated = function (provider, row, count) {
 console.log("DataProvider rows updated from " + row + 'to' + (count + row));
};
```

<hr/>

### onRowUpdated

A callback notifying that a row of data has been modified

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number) =&gt; void

**Remarks:**

Occurs after modification is completed when `true`{/* */} is returned from [onRowUpdating](/refs/Class/LocalDataProvider#onrowupdating).

\[Parameter list\]

`provider` - DataProvider control

`row` - Index of the changed data row

**Example:**


```js
dataProvider.onRowUpdated = function (provider, row) {
 console.log("DataProvider row updated: " + row);
};
```

<hr/>

### onRowUpdating

A callback that determines whether a data row has been modified

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number, oldValues: [RowValues](/refs/realgrid#rowvalues){/* */}, newValues: [RowValues](/refs/realgrid#rowvalues){/* */}) =&gt; boolean

**Remarks:**

Called just before a data row is modified to check whether the row has been modified. [onRowUpdated](/refs/Class/LocalDataProvider#onrowupdated){/* */} occurs after the row has been modified.

If a function is not bound to the event, it returns `true`{/* */} by default.

\[Parameter List\]

`provider` - DataProvider control

`row` - Index of the data row that has been changed

`oldValues` - Values of the existing data row

`newValues` - Values of the data row to be modified

**Example:**

```js
dataProvider.onRowUpdating = function (provider, row) {
 if(row % 2 === 0) {
 console.log("DataProvider row updated: " + row);
 return true;
 }
 return false;
};
```

<hr/>

### onValueChanged

A callback notifying that the value of a data cell has changed.

`Type` - (provider: [LocalDataProvider](/refs/Class/LocalDataProvider){/* */}, row: number, field: number) =&gt; void

**Remarks:**

Occurs when changing data using [setValue()](/refs/Class/LocalDataProvider#setvalue).

\[Parameter list\]

`provider` - DataProvider control

`row` - Index of the row whose value changed

`field` - Index of the field whose value changed

**Example:**


```js
dataProvider.onValueChanged = function (provider, row, field) {
 console.log('DataProvider row Value changed at ' + row + ' on ' + field);
};
```

<hr/>

## Properties Desc

### rowCount

Reads or sets rowCount. For setting, see [LocalDataProvider.setRowCount()](/refs/Class/LocalDataProvider#setrowcount).

`Type` - number

<hr/>

## Method Desc

### addRow

Add a row of data

**\[Parameter List\]**

`values` - [DataValues](/refs/realgrid#datavalues)

The value of the row to add, an array, or Object

**\[return value\] -** number

**Example:**


```js
dataProvider.addRow({
    FieldA: 'GHI';
    FieldB: 15
});
```

<hr/>

### addRows

Get it from the data source and add it to the data set.

**\[Parameter List\]**

`rows` - [DataValues](/refs/realgrid#datavalues){/* */}\[\]

Data source, two-dimensional array, or array of objects

`start` - number

Starting row of data to fill in the data set, default value `0`

`count` - number

Data to fill in the data setNumber of data, if `-1`{/* */}, the number of data is added as the number of data sources, default value: `-1`

`rowEvents` - boolean

If true, an additional event occurs per row, and if false, a multi-row additional event occurs once. Default: `false`

**\[Return Value\] -** void

**Example:**


```js
dataProvider.addRows([
  {
    FieldA: 'GHI';
    FieldB: 15
  }, {
    FieldA: 'KLM';
    FieldB: 31
  }]);
```

<hr/>

### clearRows

Initialize the data set

**Example:**


```js
dataProvider.clearRows();
```

<hr/>

### fillCsvData

Create a data set by parsing strings from the CSV data source.

**\[Parameter List\]**

`data` - any

CSV string

`options` - [DataFillOptions](/refs/Interface/DataFillOptions)

Set data extraction and filling method, [DataFillOptions](/refs/Interface/DataFillOptions) object or object with the same structure as DataFillOptions

**\[Return Value\] -** void

**Example:**


```js
let options = {
      start: 1,
      count: 3
}

dataProvider.fillCsvData(data, options);
```

<hr/>

### fillJsonData

Create a data set by importing data from a JSON data source.

**\[Parameter List\]**

`data` - any

Data source, JSON string, or array of objects

`options` - [DataFillOptions](/refs/Interface/DataFillOptions)

Set data extraction and filling method, [DataFillOptions](/refs/Interface/DataFillOptions) or DataFillOptions object, operates as default if `null`{/* */}

**\[Return Value\] -** void

**Example:**


```js
let options = {
      start: 1,
      count: 3
}

dataProvider.fillJsonData([
  {
    FieldA: 'ABC';
    FieldB: 10
  }, {
    FieldA: 'DEF';
    FieldB: 30
  }], options);
```

<hr/>

### fillXmlData

Create a data set by parsing a string from an XML data source.

**\[Parameter List\]**

`data` - any

XML string

`options` - [DataFillOptions](/refs/Interface/DataFillOptions)

Set data extraction and filling method, [DataFillOptions](/refs/Interface/DataFillOptions) object or object with the same structure as DataFillOptions

**\[Return Value\] -** void

**Example:**


```js
let options = {
      start: 1,
      count: 3
}

dataProvider.fillXmlData(data, options);
```

<hr/>

### getFieldValues

Returns data from a specific section corresponding to a specific field in the data set.

**\[Parameter List\]**

`field` - number \| string

`startRow` - number

Index of starting row, default: `0`

`endRow` - number

Index of the last row, -1 to the end of the data set, default: `-1`

**\[Return Value\] -** any\[\]

<hr/>

### getHiddenRows

Returns the indices of hidden data rows.

**Example:**


```js
let hiddens = dataProvider.getHiddenRows();
```

<hr/>

### getJsonRow

Converts the value of the specified data row to Object type.

**\[Parameter List\]**

`row` - number

Row unique number

`rowState` - boolean

If `true`{/* */}, the status value of the row is added.

**\[Return Value\] -** [RowObject](/refs/realgrid#rowobject)

**Example:**


```js
let jsonRow = ds.getJsonRow(5);
```

<hr/>

### getJsonRows

Returns data from a specific section of the data set as an Object array.

**\[Parameter List\]**

`startRow` - number

Index of starting data row, default: `0`

`endRow` - number

Index of the end data row, -1 to the end of the data set

`rowState` - boolean

If `true`{/* */}, the status value of the row is added to the result value.

**\[Return value\] -** object\[\]

**Example:**


```js
let rows = dataProvider.getJsonRows();
```

<hr/>

### getOutputRow

A specific data row in the data set is returned as an Object according to the settings.

**\[Parameter List\]**

`options` - [DataOutputOptions](/refs/Interface/DataOutputOptions)

Setting the method of returning data, same as [DataOutputOptions](/refs/Interface/DataOutputOptions)

`row` - number

index of data row

**\[return value\] -** object

**Example:**


```js
let opt = {
      nullText: 'empty value'
}
let row = dataProvider.getOutputRow(opt, 4);
```

<hr/>

### getOutputRows

Data from a specific section of the data set is returned as an Object array according to the settings.

**\[Parameter List\]**

`options` - [DataOutputOptions](/refs/Interface/DataOutputOptions)

Setting the method of returning data, same as [DataOutputOptions](/refs/Interface/DataOutputOptions)

`startRow` - number

Index of starting data row, default: `0`

`endRow` - number

Index of the end data row, -1 to the end of the data set, default: `-1`

**\[Return value\] -** object\[\]

**Example:**


```js
let opt = {
      nullText: 'empty value'
}
let rows = dataProvider.getOutputRows(opt, 4, 10);
```

<hr/>

### getRowCount

Returns the number of data set.

**Example:**


```js
let rowCount = ds.getRowCount();
```

<hr/>

### getRows

Returns data from a specific section of the data set as a two-dimensional array.

**\[Parameter List\]**

`startRow` - number

Starts when the index of the starting data row is 0, default value: `0`

`endRow` - number

Index of the end data row, `-1`{/* */} to the end of the data set, default: `-1`

**\[Return Value\] -** [RowValues](/refs/realgrid#rowvalues){/* */}\[\]

**Example:**


```js
let rows = dataProvider.getRows();
```

<hr/>

### getValue

Returns the value of a specific field in a specific data row.

**\[Parameter List\]**

`row` - number

Index of the data row to get the value from

`field` - number \| string

Index or field name of the field to retrieve the value from

**\[return value\] -** any

**Example:**


```js
let val = dataProvider.getValue(2, 10);
```

<hr/>

### hideRows

Used to hide specific rows from the View.

**\[Parameter List\]**

`dataRows` - number\[\] \| number

Index or array of indices of rows of hidden data

**\[Return Value\] -** void

**Remarks:**

If addition or deletion of a data set occurs in a hidden state, the index will change, so caution is required.

**Example:**


```js
// single
dataProvider.hideRows(3);

//multiple
dataProvider.hideRows([3,2,1]);
```

<hr/>

### insertRow

Insert a row of data at a specific location

**\[Parameter List\]**

`row` - number

Index of the data row to insert

`values` - [DataValues](/refs/realgrid#datavalues)

The value, array, or object of the row to insert

**\[return value\] -** boolean

**Example:**


```js
dataProvider.insertRow(4, {
    FieldA: 'DNA';
    FieldB: 15
});
```

<hr/>

### insertRows

It is retrieved from a data source and inserted into a specific location in the data set.

**\[Parameter List\]**

`row` - number

Index of the data row to insert

`rows` - [DataValues](/refs/realgrid#datavalues){/* */}\[\]

Data source, two-dimensional array, or array of Objects

`start` - number

The starting row of data to fill in the data set,Default value: `0`

`count` - number

Number of data to be filled in the data set. If -1, the number of data is inserted as the number of data sources. Default: `-1`

`rowEvents` - boolean

If true, an additional event occurs per row, and if false, a multi-row additional event occurs once. Default: `false`

**\[Return Value\] -** void

**Example:**


```js
dataProvider.insertRows(10, [
  {
    FieldA: 'OPQ';
    FieldB: 34
  }, {
    FieldA: 'RST';
    FieldB: 27
  }]);
```

<hr/>

### isHiddenRow

Returns whether a specific row is hidden.

**\[Parameter List\]**

`dataRow` - number

Index of the data row to check

**\[return value\] -** boolean

**Example:**


```js
let isHidden = dataProvider.isHiddenRow(3);
```

<hr/>

### moveRow

Move a specific row of data

**\[Parameter List\]**

`row` - number

`newRow` - number

new index

**\[Return Value\] -** void

**Example:**


```js
dataProvider.moveRow(2, 5);
```

<hr/>

### moveRows

Move multiple data rows.

**\[Parameter List\]**

`row` - number

Index of the first row of data to be moved

`count` - number

Number of rows of data to move

`newRow` - number

Index of the row to be moved

**\[Return Value\] -** void

**Example:**


```js
dataProvider.moveRows(2, 2, 5);
```

<hr/>

### removeRow

Remove rows of data at a specific location

**\[Parameter List\]**

`row` - number

Index of data row to remove

**\[Return Value\] -** void

**Example:**


```js
dataProvider.removeRow(2);
```

<hr/>

### removeRows

Removes multiple data rows at a specific location.

**\[Parameter List\]**

`rows` - number\[\]

Array of data row indices to remove

`rowEvents` - boolean

Whether individual events occur, default: `false`

**\[Return Value\] -** void

**Example:**


```js
dataProvider.removeRows([2,3,4]);
```

<hr/>

### resetHiddenRows

Initializes the hidden state of all rows.

**Example:**


```js
dataProvider.resetHiddenRows();
```

<hr/>

### searchData

Finds cells with a specific value depending on how the search is set up.

**\[Parameter List\]**

`options` - [SearchCellOptions](/refs/Interface/SearchCellOptions)

Search method, specified by [SearchCellOptions](/refs/Interface/SearchCellOptions) model.

**\[Return value\] -** [SearchCellResult](/refs/Interface/SearchCellResult)

**Example:**


```js
ds.searchData({fields:['fieldName'], value: 'value'});
```

<hr/>

### searchDataRow

Depending on how the search is set up, it finds rows with a specific value.

**\[Parameter List\]**

`options` - [SearchOptions](/refs/Interface/SearchOptions)

Search method, specified by [SearchOptions](/refs/Interface/SearchOptions) model.

**\[return value\] -** number

**Example:**


```js
ds.searchDataRow({fields:['fieldName'], values: ['value']});
```

<hr/>

### setFilterMode

Set operation conditions between filters.

**\[Parameter List\]**

`filterMode` - string

Operation conditions of filters. `'and'`{/* */}or `'or'`

**\[Return Value\] -** void

**Remarks:**

Sets the operation conditions of filters to AND or OR. This is the same function as specifying filterMode in [setFilters](/refs/Class/LocalDataProvider#setfilters){/* */}.

<hr/>

### setFilters

Filter data from a data set.

**\[Parameter List\]**

`filters` - [DataFilters](/refs/realgrid#datafilters)

Filter setting value

`filterMode` - string

Filter operation conditions. `'and'`{/* */}or `'or'` c.

**\[Return Value\] -** void

**Remarks:**

Apply filter to DataProvider. Rows that do not match the filter will not exist in the DataProvider.

**Example:**


```js
//nonArray
dataProvider.setFilters({criteria: "value['field1']='Singer'"});

// string
dataProvider.setFilters([
   "value['field1']='Singer'",
   "value['field2']='Woman'"
], "and");

//object
dataProvider.setFilters([
   {criteria: "value['field1']='Singer'"},
   {criteria: "value['field2']='Woman'"}
], "and");
```

<hr/>

### setRowCount

Set the number of data items in the data set.

**\[Parameter List\]**

`newCount` - number

Number of new data

`fillFieldDefaults` - boolean

Whether to insert a value using the default value of the field when a new row is added, default value: `false`

`defaultValues` - [DataValues](/refs/realgrid#datavalues)

When a new row is added, the values corresponding to each field, default value: `null`{/* */}, are used in field order.

`rowState` - [RowState](/refs/realgrid#rowstate)

State of new row, default: [RowState.NONE](/refs/realgrid#rowstate)

**\[Return Value\] -** void

**Remarks:**

Forcefully sets the number of data items in the data set. If the number of existing rows is greater than the number of new rows, it is truncated and discarded, and if the number of new rows is greater, a new row is added.

**Example:**


```js
ds.setRowCount(100);
```

<hr/>

### setRows

Populate the data set by pulling from a data source.

**\[Parameter List\]**

`rows` - [DataValues](/refs/realgrid#datavalues){/* */}\[\]

Data source, two-dimensional array, or array of objects

`start` - number

Starting row of data to fill in the data set, default: `0`

`count` - number

Number of data to be filled in the data set, if `-1`{/* */}, fill as many as the number of data sources. Default: `-1`

**\[Return Value\] -** void

**Example:**


```js
dataProvider.setRows([
  {
    FieldA: 'ABC';
    FieldB: 10
  }, {
    FieldA: 'DEF';
    FieldB: 30
  }]);
```

<hr/>

### setValue

Change the value of a specific field in a specific data row.

**\[Parameter List\]**

`row` - number

Index of the data row whose value you want to change

`field` - number \| string

Index or field name of the field whose value you want to change

`newValue` - any

new value to change

**\[Return Value\] -** void

**Example:**


```js
dataProvider.setValue(2, 5, 'newValue');
```

<hr/>

### showHiddenRows

Redisplays hidden data rows.

**\[Parameter List\]**

`dataRows` - number\[\] \| number

Index or array of indices of the row of data to redisplay

**\[Return Value\] -** void

**Example:**


```js
// single
dataProvider.showHiddenRows(3);

//multiple
dataProvider.showHiddenRows([3,2,1]);
```

<hr/>

### updateRow

Changes the value of a specific data row in a data set.

**\[Parameter List\]**

`row` - number

Index of the data row to change

`values` - [DataValues](/refs/realgrid#datavalues)

Data to be changed in the row is retrieved from the array in order of field index.

`strict` - boolean

Fields whose value is `undefined` or are not specified retain their existing values.

**\[Return Value\] -** void

**Example:**


```js
dataProvider.updateRow(3, ['value1', 'value2', 'value3', 'value4'], true);
```

<hr/>

### updateRows

Retrieves data from a data source and changes it to a specific location in the data set.

**\[Parameter List\]**

`row` - number

data row to changeindex

`rows` - [DataValues](/refs/realgrid#datavalues){/* */}\[\]

Data source, two-dimensional array, or array of Objects

`start` - number

Starting row of data to fill in the data set, default: `0`

`count` - number

Number of data to be filled in the data set, if `-1`{/* */}, it will be changed by the number of data sources, default value: `-1`

`strict` - boolean

Whether to change if the value of textField is `null`{/* */}, `undefined` ``{/* */}. If `false`{/* */}, it is judged to be the same value and is not changed.

`rowEvents` - boolean

If `true`{/* */}, [onRowUpdated](/refs/Class/LocalDataProvider#onrowupdated){/* */} is called for each row. If `false`{/* */}, call [onRowsUpdated](/refs/Class/LocalDataProvider#onrowsupdated){/* */}.

**\[Return Value\] -** void

**Example:**


```js
dataProvider.updateRows(10, [
  {
    FieldA: 'OPQ';
    FieldB: 34
  }, {
    FieldA: 'RST';
    FieldB: 27
  }]);
```

<hr/>

### updateRowsByDataRow

Batch edit non-consecutive rows.

**\[Parameter List\]**

`rows` - \{ \[key: number\]: [DataValues](/refs/realgrid#datavalues){/* */}; \}

Data Source &amp;\#123;1:&amp;\#123;"field1":value, "field2":value2&amp;\#125;, ...&amp;\#125;

`strict` - boolean

Whether to change if the value of textField is `null`{/* */}, `undefined` ``{/* */}. If `false`{/* */}, it is judged to be the same value and is not changed.

`rowEvents` - boolean

If `true`{/* */}, [onRowUpdated](/refs/Class/LocalDataProvider#onrowupdated){/* */} is called for each row. If `false`{/* */}, call [onRowListUpdated](/refs/Class/LocalDataProvider#onrowlistupdated){/* */}.

**\[Return Value\] -** void

**Example:**


```js
var data = {
      1:{"field1":value1, "field2":value2},
      3:{"field1":value1, "field2":value2}
}
dataProvider.updateRowsByDataRow(data);
```

<hr/>