LocalDataProvider
LocalDataProvider class. Inherits DataProviderBase.
Signature:
export declare class LocalDataProvider extends DataProviderBase
Extends: DataProviderBase
Remarks
[Superclass]
Events
Property | Type | Description |
---|---|---|
onDataChanged | (provider: LocalDataProvider) => void | A callback notifying that the value of the data set has changed |
onRestoreRows | (provider: LocalDataProvider, rows: number[]) => void | A callback indicating that the state of multiple data rows has been restored |
onRowCountChanged | (provider: LocalDataProvider, newCount: number) => void | A callback notifying that the number of data rows has changed |
onRowDeleted | (provider: LocalDataProvider, row: number) => void | A callback indicating that a row of data has been deleted |
onRowDeleting | (provider: LocalDataProvider, row: number) => boolean | A callback that determines deletion of a data row |
onRowInserted | (provider: LocalDataProvider, row: number) => void | A callback notifying that a row of data has been added |
onRowInserting | (provider: LocalDataProvider, row: number, values: DataValues) => boolean | A callback that determines whether to add a row of data |
onRowListMoved | (provider: LocalDataProvider, rows: number[], newRow: number) => void | A callback indicating that multiple rows of data have been moved |
onRowListMoving | (provider: LocalDataProvider, rows: number[], newRow: number) => boolean | Callback that determines row movement using the mouse |
onRowListUpdated | (provider: LocalDataProvider, rows: number[]) => void | A callback to indicate that multiple rows of data have changed |
onRowMoved | (provider: LocalDataProvider, row: number, newRow: number) => void | A callback indicating that a row of data has been moved |
onRowMoving | (provider: LocalDataProvider, row: number, newRow: number) => boolean | A callback that determines the movement of a row of data |
onRowsDeleted | (provider: LocalDataProvider, rows: number[]) => void | A callback indicating that a row of data has been deleted |
onRowsInserted | (provider: LocalDataProvider, row: number, count: number) => void | A callback to notify when multiple data rows are added in batches |
onRowsMoved | (provider: LocalDataProvider, row: number, count: number, newRow: number) => void | A callback indicating that multiple rows of data have been moved |
onRowsMoving | (provider: LocalDataProvider, row: number, count: number, newRow: number) => boolean | A callback that determines the movement of multiple data rows |
onRowStateChanged | (provider: LocalDataProvider, row: number) => void | A callback notifying that the state of a data row has changed |
onRowStatesChanged | (provider: LocalDataProvider, rows: number[]) => void | Callback notifying that the status of multiple data rows has been changed at once |
onRowStatesCleared | (provider: LocalDataProvider) => void | A callback indicating that the status of all rows has been initialized |
onRowsUpdated | (provider: LocalDataProvider, row: number, count: number) => void | A callback notifying that multiple data rows have been modified in batches |
onRowUpdated | (provider: LocalDataProvider, row: number) => void | A callback notifying that a row of data has been modified |
onRowUpdating | (provider: LocalDataProvider, row: number, oldValues: RowValues, newValues: RowValues) => boolean | Callback that determines whether a data row has been modified |
onValueChanged | (provider: LocalDataProvider, row: number, field: number) => void | A callback notifying that the value of a data cell has changed |
Properties
Property | Type | Description |
---|---|---|
rowCount | number | Reads or sets rowCount. For setting, see LocalDataProvider.setRowCount(). |
Methods
Method | Type | Description |
---|---|---|
addRow(values) | addRow(values: DataValues): number; | Add a row of data |
addRows(rows, start, count, rowEvents) | addRows(rows: DataValues[], start?: number, count?: number, rowEvents?: boolean): void; | Get it from the data source and add it to the data set. |
clearRows() | clearRows(): void; | Initialize data set |
fillCsvData(data, options) | fillCsvData(data: any, options?: DataFillOptions): void; | Create a data set by parsing strings from the CSV data source. |
fillJsonData(data, options) | fillJsonData(data: any, options?: DataFillOptions): void; | Create a data set by importing data from a JSON data source. |
fillXmlData(data, options) | fillXmlData(data: any, options?: DataFillOptions): void; | Create a data set by parsing a string from an XML data source. |
getFieldValues(field, startRow, endRow) | 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() | getHiddenRows(): number[]; | Returns the indices of hidden data rows. |
getJsonRow(row, rowState) | getJsonRow(row: number, rowState?: boolean): RowObject; | Converts the value of the specified data row to Object type. |
getJsonRows(startRow, endRow, rowState) | 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) | getOutputRow(options: 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) | getOutputRows(options: 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() | getRowCount(): number; | Returns the number of data items in the data set. |
getRows(startRow, endRow) | getRows(startRow?: number, endRow?: number): RowValues[]; | Returns data from a specific section of the data set as a two-dimensional array. |
getValue(row, field) | getValue(row: number, field: number | string): any; | Returns the value of a specific field in a specific data row. |
hideRows(dataRows) | hideRows(dataRows: number[] | number): void; | Used to hide specific rows from the View. |
insertRow(row, values) | insertRow(row: number, values: DataValues): boolean; | Insert a row of data at a specific location |
insertRows(row, rows, start, count, rowEvents) | insertRows(row: number, rows: 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) | isHiddenRow(dataRow: number): boolean; | Returns whether a specific row is hidden. |
moveRow(row, newRow) | moveRow(row: number, newRow: number): void; | Move specific data row |
moveRows(row, count, newRow) | moveRows(row: number, count: number, newRow: number): void; | Move multiple data rows. |
removeRow(row) | removeRow(row: number): void; | Remove data row at a specific location |
removeRows(rows, rowEvents) | removeRows(rows: number[], rowEvents?: boolean): void; | Removes multiple data rows at a specific location. |
resetHiddenRows() | resetHiddenRows(): void; | Initializes the hidden state of all rows. |
searchData(options) | searchData(options: SearchCellOptions): SearchCellResult; | Finds cells with a specific value depending on how the search is set up. |
searchDataRow(options) | searchDataRow(options: SearchOptions): number; | Depending on how the search is set up, it finds rows with a specific value. |
setFilterMode(filterMode) | setFilterMode(filterMode?: string): void; | Set operation conditions between filters. |
setFilters(filters, filterMode) | setFilters(filters: DataFilters, filterMode?: string): void; | Filter data from a data set. |
setRowCount(newCount, fillFieldDefaults, defaultValues, rowState) | setRowCount(newCount: number, fillFieldDefaults?: boolean, defaultValues?: DataValues, rowState?: RowState): void; | Set the number of data items in the data set. |
setRows(rows, start, count) | setRows(rows: DataValues[], start?: number, count?: number): void; | Populate the data set by pulling from a data source. |
setValue(row, field, newValue) | setValue(row: number, field: number | string, newValue: any): void; | Change the value of a specific field in a specific data row. |
showHiddenRows(dataRows) | showHiddenRows(dataRows: number[] | number): void; | Redisplays hidden data rows. |
updateRow(row, values, strict) | updateRow(row: number, values: DataValues, strict?: boolean): void; | Changes the value of a specific data row in a data set. |
updateRows(row, rows, start, count, strict, rowEvents) | updateRows(row: number, rows: 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) | updateRowsByDataRow(rows: { [key: number]: 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) => void
Remarks:
setValue() Occurs when the value is changed by input from the function or View.
[Parameter list]
provider
- DataProvider control
Example:
dataProvider.onDataChanged = function (provider) {
console.log('dataChanged!');
};
onRestoreRows
A callback indicating that the state of multiple data rows has been restored.
Type
- (provider: LocalDataProvider, rows: number[]) => void
Remarks:
Occurs when rows modified through the restoreUpdatedRows() function are restored.
[Parameter list]
provider
- DataProvider control
rows
- indexed array of restored data rows
Example:
dataProvider.onRestoreRows = function (provider, rows) {
console.log('dataProvider row restored: ' + rows.join(', '));
};
onRowCountChanged
A callback notifying that the number of rows of data has changed.
Type
- (provider: LocalDataProvider, newCount: number) => 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:
dataProvider.onRowCountChanged = function (provider, newCount) {
console.log("DataProvider rowCount changed as: " + newCount);
};
onRowDeleted
A callback notifying that a row of data has been deleted
Type
- (provider: LocalDataProvider, row: number) => void
Remarks:
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:
dataProvider.onRowDeleted = function (provider, row) {
console.log('dataProvider row deleted: ' + row);
};
onRowDeleting
A callback that determines deletion of a row of data
Type
- (provider: LocalDataProvider, row: number) => boolean
Remarks:
Called just before a data row is deleted to check whether the row has been deleted. 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:
dataProvider.onRowDeleting = function (provider, row) {
if (row < 100) {
return false;
}
return true;
};
onRowInserted
Callback to notify when a row of data has been added
Type
- (provider: LocalDataProvider, row: number) => void
Remarks:
Occurs after the onRowInserting callback returns true
and the row has been added.
[Parameter list]
provider
- DataProvider control
row
- Index of the added data row
Example:
dataProvider.onRowInserted = function (provider, row) {
console.log("DataProvider row inserted!");
};
onRowInserting
A callback that determines whether to add a row of data.
Type
- (provider: LocalDataProvider, row: number, values: DataValues) = > boolean
Remarks:
Called just before a data row is added to check whether the row has been added. 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
Example:
dataProvider.onRowInserting = function (provider, row, values) {
if (row > 100) {
return false;
}
return true;
};
onRowListMoved
Callback notifying that multiple rows of data have been moved
Type
- (provider: LocalDataProvider, rows: number[], newRow: number) => void
Remarks:
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:
dataProvider.onRowListMoved = function (provider, rows, newRow) {
console.log('DataProvider ' + rows.length + ' rows moved!');
};
onRowListMoving
Callback that determines row movement using the mouse
Type
- (provider: LocalDataProvider, rows: number[], newRow: number) => boolean
Remarks:
It is called right before multiple data rows are moved to determine whether the rows will be moved. 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:
dataProvider.onRowListMoving = function (provider, rows, newRow) {
return rows.length === 1)
};
onRowListUpdated
Callback to notify that multiple rows of data have changed
Type
- (provider: LocalDataProvider, rows: number[]) => void
Remarks:
[Parameter list]
provider
- DataProvider control
rows
- Index of changed data rows
Example:
dataProvider.onRowListUpdated = function (provider, rows) {
console.log("DataProvider rows updated: " + rows.join(', '));
};
onRowMoved
A callback notifying that a row of data has been moved
Type
- (provider: LocalDataProvider, row: number, newRow: number) => void
Remarks:
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:
dataProvider.onRowMoved = function (provider, row, newRow) {
console.log('DataProvider row moved from ' + row + ' to ' + newRow);
};
onRowMoving
A callback that determines the movement of a row of data
Type
- (provider: LocalDataProvider, row: number, newRow: number) => boolean
Remarks:
It is called right before the data row is moved to determine whether the row will be moved. 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:
dataProvider.onRowMoving = function (provider, row, newRow) {
if (row < newRow) {
return false;
}
return true;
};
onRowsDeleted
A callback notifying that a row of data has been deleted
Type
- (provider: LocalDataProvider, rows: number[]) => void
Remarks:
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:
dataProvider.onRowsDeleted = function (provider, rows) {
console.log('DataProvider rows deleted: ' + rows.join(', '));
};
onRowsInserted
Callback to notify when multiple data rows are added in batches
Type
- (provider: LocalDataProvider, row: number, count: number) => void
Remarks:
This occurs when events are collectively reflected in functions such as LocalDataProvider.insertRows().
[Parameter list]
provider
- DataProvider control
row
- Index of the starting data row that was changed
count
- Number of changed rows
Example:
dataProvider.onRowsInserted = function (provider, row, count) {
console.log("DataProvider " + count + " rows inserted!");
};
onRowsMoved
Callback notifying that multiple rows of data have been moved
Type
- (provider: LocalDataProvider, row: number, count: number, newRow: number) => void
Remarks:
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:
dataProvider.onRowsMoved = function (provider, row, count, newRow) {
console.log('DataProvider ' + count + ' rows moved!');
};
onRowsMoving
A callback that determines the movement of multiple data rows
Type
- (provider: LocalDataProvider, row: number, count: number, newRow: number) => boolean
Remarks:
It is called right before multiple data rows are moved to determine whether the rows will be moved. 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:
dataProvider.onRowsMoving = function (provider, row, count, newRow) {
if (row < newRow || count > 20) {
return false;
}
return true;
};
onRowStateChanged
A callback notifying that the state of a data row has changed
Type
- (provider: LocalDataProvider, row: number) => 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:
dataProvider.onRowStateChanged = function (provider, row) {
console.log('dataProvider row state changed: ' + row);
};
onRowStatesChanged
Callback notifying that the status of multiple data rows has changed at once
Type
- (provider: LocalDataProvider, rows: number[]) => 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:
dataProvider.onRowStatesChanged = function (provider, rows) {
console.log('dataProvider row state changed: ' + rows.join(','));
};
onRowStatesCleared
Callback notifying that the state of all rows has been initialized
Type
- (provider: LocalDataProvider) => void
Remarks:
Occurs after all row states have been initialized via DataProviderBase.clearRowStates()
[Parameter list]
provider
- DataProvider control
Example:
dataProvider.onRowStatesCleared = function (provider) {
console.log('dataProvider row state cleared!');
};
onRowsUpdated
Callback notifying that multiple data rows have been modified in batches
Type
- (provider: LocalDataProvider, row: number, count: number) => void
Remarks:
This occurs when events are collectively reflected in functions such as updateRows.
[Parameter list]
provider
- DataProvider control
row
- Index of the starting data row that was changed
count
- Number of changed rows
Example:
dataProvider.onRowsUpdated = function (provider, row, count) {
console.log("DataProvider rows updated from " + row + 'to' + (count + row));
};
onRowUpdated
A callback notifying that a row of data has been modified
Type
- (provider: LocalDataProvider, row: number) => void
Remarks:
Occurs after modification is completed when true
is returned from onRowUpdating.
[Parameter list]
provider
- DataProvider control
row
- Index of the changed data row
Example:
dataProvider.onRowUpdated = function (provider, row) {
console.log("DataProvider row updated: " + row);
};
onRowUpdating
A callback that determines whether a data row has been modified
Type
- (provider: LocalDataProvider, row: number, oldValues: RowValues, newValues: RowValues) => boolean
Remarks:
Called just before a data row is modified to check whether the row has been modified. 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:
dataProvider.onRowUpdating = function (provider, row) {
if(row % 2 === 0) {
console.log("DataProvider row updated: " + row);
return true;
}
return false;
};
onValueChanged
A callback notifying that the value of a data cell has changed.
Type
- (provider: LocalDataProvider, row: number, field: number) => void
Remarks:
Occurs when changing data using setValue().
[Parameter list]
provider
- DataProvider control
row
- Index of the row whose value changed
field
- Index of the field whose value changed
Example:
dataProvider.onValueChanged = function (provider, row, field) {
console.log('DataProvider row Value changed at ' + row + ' on ' + field);
};
Properties Desc
rowCount
Reads or sets rowCount. For setting, see LocalDataProvider.setRowCount().
Type
- number
Method Desc
addRow
Add a row of data
[Parameter List]
values
- DataValues
The value of the row to add, an array, or Object
[return value] - number
Example:
dataProvider.addRow({
FieldA: 'GHI';
FieldB: 15
});
addRows
Get it from the data source and add it to the data set.
[Parameter List]
rows
- 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:
dataProvider.addRows([
{
FieldA: 'GHI';
FieldB: 15
}, {
FieldA: 'KLM';
FieldB: 31
}]);
clearRows
Initialize the data set
Example:
dataProvider.clearRows();
fillCsvData
Create a data set by parsing strings from the CSV data source.
[Parameter List]
data
- any
CSV string
options
- DataFillOptions
Set data extraction and filling method, DataFillOptions object or object with the same structure as DataFillOptions
[Return Value] - void
Example:
let options = {
start: 1,
count: 3
}
dataProvider.fillCsvData(data, options);
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
Set data extraction and filling method, DataFillOptions or DataFillOptions object, operates as default if null
[Return Value] - void
Example:
let options = {
start: 1,
count: 3
}
dataProvider.fillJsonData([
{
FieldA: 'ABC';
FieldB: 10
}, {
FieldA: 'DEF';
FieldB: 30
}], options);
fillXmlData
Create a data set by parsing a string from an XML data source.
[Parameter List]
data
- any
XML string
options
- DataFillOptions
Set data extraction and filling method, DataFillOptions object or object with the same structure as DataFillOptions
[Return Value] - void
Example:
let options = {
start: 1,
count: 3
}
dataProvider.fillXmlData(data, options);
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[]
getHiddenRows
Returns the indices of hidden data rows.
Example:
let hiddens = dataProvider.getHiddenRows();
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
Example:
let jsonRow = ds.getJsonRow(5);
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:
let rows = dataProvider.getJsonRows();
getOutputRow
A specific data row in the data set is returned as an Object according to the settings.
[Parameter List]
options
- DataOutputOptions
Setting the method of returning data, same as DataOutputOptions
row
- number
index of data row
[return value] - object
Example:
let opt = {
nullText: 'empty value'
}
let row = dataProvider.getOutputRow(opt, 4);
getOutputRows
Data from a specific section of the data set is returned as an Object array according to the settings.
[Parameter List]
options
- DataOutputOptions
Setting the method of returning data, same as 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:
let opt = {
nullText: 'empty value'
}
let rows = dataProvider.getOutputRows(opt, 4, 10);
getRowCount
Returns the number of data set.
Example:
let rowCount = ds.getRowCount();
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[]
Example:
let rows = dataProvider.getRows();
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:
let val = dataProvider.getValue(2, 10);
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:
// single
dataProvider.hideRows(3);
//multiple
dataProvider.hideRows([3,2,1]);
insertRow
Insert a row of data at a specific location
[Parameter List]
row
- number
Index of the data row to insert
values
- DataValues
The value, array, or object of the row to insert
[return value] - boolean
Example:
dataProvider.insertRow(4, {
FieldA: 'DNA';
FieldB: 15
});
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[]
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:
dataProvider.insertRows(10, [
{
FieldA: 'OPQ';
FieldB: 34
}, {
FieldA: 'RST';
FieldB: 27
}]);
isHiddenRow
Returns whether a specific row is hidden.
[Parameter List]
dataRow
- number
Index of the data row to check
[return value] - boolean
Example:
let isHidden = dataProvider.isHiddenRow(3);
moveRow
Move a specific row of data
[Parameter List]
row
- number
newRow
- number
new index
[Return Value] - void
Example:
dataProvider.moveRow(2, 5);
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:
dataProvider.moveRows(2, 2, 5);
removeRow
Remove rows of data at a specific location
[Parameter List]
row
- number
Index of data row to remove
[Return Value] - void
Example:
dataProvider.removeRow(2);
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:
dataProvider.removeRows([2,3,4]);
resetHiddenRows
Initializes the hidden state of all rows.
Example:
dataProvider.resetHiddenRows();
searchData
Finds cells with a specific value depending on how the search is set up.
[Parameter List]
options
- SearchCellOptions
Search method, specified by SearchCellOptions model.
[Return value] - SearchCellResult
Example:
ds.searchData({fields:['fieldName'], value: 'value'});
searchDataRow
Depending on how the search is set up, it finds rows with a specific value.
[Parameter List]
options
- SearchOptions
Search method, specified by SearchOptions model.
[return value] - number
Example:
ds.searchDataRow({fields:['fieldName'], values: ['value']});
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.
setFilters
Filter data from a data set.
[Parameter List]
filters
- 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:
//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");
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
When a new row is added, the values corresponding to each field, default value: null
, are used in field order.
rowState
- RowState
State of new row, default: RowState.NONE
[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:
ds.setRowCount(100);
setRows
Populate the data set by pulling from a data source.
[Parameter List]
rows
- 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:
dataProvider.setRows([
{
FieldA: 'ABC';
FieldB: 10
}, {
FieldA: 'DEF';
FieldB: 30
}]);
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:
dataProvider.setValue(2, 5, 'newValue');
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:
// single
dataProvider.showHiddenRows(3);
//multiple
dataProvider.showHiddenRows([3,2,1]);
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
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:
dataProvider.updateRow(3, ['value1', 'value2', 'value3', 'value4'], true);
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[]
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 is called for each row. If false
, call onRowsUpdated.
[Return Value] - void
Example:
dataProvider.updateRows(10, [
{
FieldA: 'OPQ';
FieldB: 34
}, {
FieldA: 'RST';
FieldB: 27
}]);
updateRowsByDataRow
Batch edit non-consecutive rows.
[Parameter List]
rows
- { [key: number]: DataValues; }
Data Source {1:{"field1":value, "field2":value2}, ...}
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 is called for each row. If false
, call onRowListUpdated.
[Return Value] - void
Example:
var data = {
1:{"field1":value1, "field2":value2},
3:{"field1":value1, "field2":value2}
}
dataProvider.updateRowsByDataRow(data);