RealGrid2 API
Class
LocalTreeDataProvider

LocalTreeDataProvider

LocalTreeDataProvider class. Inherits DataProviderBase.

Signature:

export declare class LocalTreeDataProvider extends DataProviderBase

Extends: DataProviderBase

Remarks

[Superclass]

DataProviderBase

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the LocalTreeDataProvider class.

Properties

PropertyTypeDescription
onDataChanged(provider: LocalTreeDataProvider) => voidA callback notifying that data has changed
onRowAdded(provider: LocalTreeDataProvider, row: number) => voidA callback notifying that a row has been added
onRowAdding(provider: LocalTreeDataProvider, row: number, index: number, child: any) => booleanA callback that determines whether a row is added
onRowCountChanged(provider: LocalTreeDataProvider, newCount: number) => voidCallback notifying that the number of rows has changed
onRowDeleted(provider: LocalTreeDataProvider, row: number) => voidCallback notifying that a row has been deleted
onRowDeleting(provider: LocalTreeDataProvider, row: number) => booleanA callback that determines whether to delete a row
onRowParentChanged(provider: LocalTreeDataProvider, row: number, parent: number, index: number) => voidA callback notifying that a row's parent has changed
onRowParentChanging(provider: LocalTreeDataProvider, row: number, parent: number, index: number) => booleanA callback that determines whether to change the parent of a row
onRowsAdded(provider: LocalTreeDataProvider, parent: number, rows: number[]) => voidA callback indicating that rows have been added
onRowsDeleted(provider: LocalTreeDataProvider, rows: number[]) => voidCallback notifying that rows have been deleted
onRowSiblingMoved(provider: LocalTreeDataProvider, row: number, offset: number) => voidA callback indicating that rows have been moved between siblings
onRowSiblingMoving(provider: LocalTreeDataProvider, row: number, offset: number) => booleanCallback to determine movement of rows between siblings
onRowsSiblingMoved(provider: LocalTreeDataProvider, rows: number[], offset: number) => voidA callback indicating that a sibling has been moved using dragAndDrop
onRowsSiblingMoving(provider: LocalTreeDataProvider, rows: number[], offset: number) => booleanCallback to determine movement between siblings using DragAndDrop
onRowStateChanged(provider: LocalTreeDataProvider, row: number) => voidA callback notifying that the row state has changed
onRowStatesChanged(provider: LocalTreeDataProvider, rows: number[]) => voidA callback notifying that the state of multiple rows has changed
onRowsUpdated(provider: LocalTreeDataProvider, rows: number[]) => voidA callback to indicate that multiple rows of data have changed
onRowsUpdating(provider: LocalTreeDataProvider, rows: number[]) => boolean

Callback to determine changes to multiple data rows

[Parameter list]

provider - DataProvider control

rows - Tree id of data rows to be changed

onRowUpdated(provider: LocalTreeDataProvider, row: number) => voidCallback notifying that a row has been modified
onRowUpdating(provider: LocalTreeDataProvider, row: number, oldValues: RowValues, newValues: [RowValues] (/refs/realgrid#rowvalues)) => booleanCallback to determine row modification
onValueChanged(provider: LocalTreeDataProvider, row: number, field: number) => voidA callback to indicate that the value of the data has changed

Methods

MethodTypeDescription
addChildRow(row, values, iconIndex, hasChildren)addChildRow(row: number, values: DataValues, iconIndex?: number, hasChildren?: boolean): number;Adds a child row of the specified tree row.
changeRowParent(row, parent, index)changeRowParent(row: number, parent: number, index: number): boolean;Moves the position of a specific data row to the lower part of the specified row.
clearRows()clearRows(): void;Delete all rows in DataProvider.
fillCsvData(data, options)fillCsvData(data: any, options: DataFillOptions): void;Loads csv data according to the specified settings and saves it to the TreeDataProvider local storage.
fillJsonData(data, options)fillJsonData(data: any, options: DataFillOptions): void;Loads Json data according to the specified settings and saves it to the TreeDataProvider local storage.
fillXmlData(data, options)fillXmlData(data: any, options: DataFillOptions): void;Loads xml data according to the specified settings and saves it to the TreeDataProvider local storage.
getAncestors(row)getAncestors(row: number): number[];Returns the IDs of ancestor rows of the specified row.
getChildCount(row)getChildCount(row: number): number;Returns the number of child rows of the specified row.
getChildren(row)getChildren(row: number): number[];Returns the unique numbers of all child rows of a specified row.
getDescendantCount(row)getDescendantCount(row: number): number;Returns the number of descendant rows of the specified row.
getDescendants(row, maxLevel)getDescendants(row: number, maxLevel?: number): number[];Returns the IDs of descendant rows of the specified row.
getHiddenRows()getHiddenRows(): number[];Returns the numbers of hidden rows.
getIconIndex(row)getIconIndex(row: number): number;Returns the index of the icon displayed in the tree row.
getJsonRow(row, rowState, recursive, childRowsProp, iconProp, level)getJsonRow(row: number, rowState?: boolean, recursive?: boolean, childRowsProp?: string, iconProp?: string, level?: number): any;Returns the specified data row as a JSON object.
getJsonRows(row, recursive, childRowsProp, iconProp, rowState)getJsonRows(row: number, recursive?: boolean, childRowsProp?: string, iconProp?: string, rowState?: boolean): object[];Returns the specified data row and descendants as a JSON object.
getLevel(row)getLevel(row: number): number;Returns the level of the specified row.
getOutputRow(options, row, iconProp)getOutputRow(options: DataOutputOptions, row: number, iconProp?: string): object;Imports the specified data row as a JSON object by applying the format.
getOutputRows(options, row, recursive, childRowsProp, iconProp)getOutputRows(options: DataOutputOptions, row: number, recursive?: boolean, childRowsProp?: string, iconProp?: string): object[];The specified data row and descendants are formatted and imported as a JSON object.
getParent(row)getParent(row: number): number;Returns the row id of the parent of the specified row.
getRowCount()getRowCount(): number;Returns the number of stored data rows.
getValue(row, field)getValue(row: number, field: string | number): any;Returns the value of the specified data cell.
hideRows(dataRows)hideRows(dataRows: number[] | number): void;Hides the specified row or rows from the screen.
insertChildNode(row, index, data, childrenProp, iconField, noState)insertChildNode(row: number, index: number, data: RowObject, childrenProp?: string, iconField?: string, noState?: boolean): any;Add a child node to the specified tree row at the desired location.
insertChildRow(row, index, values, iconIndex, hasChildren)insertChildRow(row: number, index: number, values: DataValues, iconIndex?: number, hasChildren?: boolean): number;Adds a child row to the desired location among the child rows of the specified tree row.
isHiddenRow(dataRow)isHiddenRow(dataRow: number): boolean;Returns whether the specified row is a hidden row.
moveRowSibling(row, offset)moveRowSibling(row: number, offset: number): boolean;The position of a specific data row is moved among siblings of the same parent by a specified number of steps.
removeRow(row, recursive)removeRow(row: number, recursive?: boolean): boolean;Deletes the specified data row.
removeRows(rows, recursive)removeRows(rows: number[], recursive: boolean): boolean;Deletes specified data rows.
resetHiddenRows()resetHiddenRows(): void;Redisplays all hidden 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.
setCsvRows(rows, treeField, needSorting, childrenField, iconField)setCsvRows(rows: string, treeField: string, needSorting?: boolean, childrenField?: string, iconField?: string): void;Set the tree data as new CSV data.
setIconIndex(row, iconIndex)setIconIndex(row: number, iconIndex: number): void;Changes the icon of the specified row.
setNestedRows(json, rowsProp, childRowsProp, childrenProp, iconProp)setNestedRows(json: any, rowsProp: string, childRowsProp: string, childrenProp?: string, iconProp?: string): void;Set the tree's data to new JSON data.
setObjectRows(json, rowsProp, childrenProp, iconProp)setObjectRows(json: any, rowsProp: string, childrenProp?: string, iconProp?: string): void;Set the tree's data to new JSON data.
setRows(rows, treeField, needSorting, childrenField, iconField)setRows(rows: DataValues[], treeField: string, needSorting?: boolean, childrenField?: string, iconField?: string): void;Set the tree data as new data.
setValue(row, field, value)setValue(row: number, field: string | number, value: any): void;Changes the value of a specified data cell.
setXmlRows(xml, rowElement, childrenField, iconField)setXmlRows(xml: any, rowElement: string, childrenField?: string, iconField?: string): void;Set the tree data as new XML data.
showHiddenRows(dataRows)showHiddenRows(dataRows: number[] | number): void;Shows hidden rows or rows on the screen.
updateRow(row, values, strict)updateRow(row: number, values: DataValues, strict?: boolean): boolean;Modifies the field values ​​of the specified data row.
updateRows(rows, values, strict)updateRows(rows: number[], values: DataValues[], strict: boolean): void;Modifies field values of specified data rows.

Properties Desc

onDataChanged

A callback to notify you that data has changed

Type - (provider: LocalTreeDataProvider) => void

Remarks:

Call after changing the data using key input or LocalTreeDataProvider.setValue().

[Parameter list]

provider - TreeDataProvider control

Example:

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

onRowAdded

A callback notifying that a row has been added

Type - (provider: LocalTreeDataProvider, row: number) => void

Remarks:

Called after data is added to TreeDataProvider.

[Parameter list]

provider - TreeDataProvider control

row - the tree id of the data row

Example:

dataProvider.onRowAdded = function (provider, row) {
 console.log("DataProvider row added at "+ row);
};

onRowAdding

A callback that determines whether a row is added

Type - (provider: LocalTreeDataProvider, row: number, index: number, child: any) => boolean

Remarks:

Called just before data is added to TreeDataProvider.

[Parameter list]

provider - TreeDataProvider control

row - the tree id of the data row

index - Position (order) of the inserted row among the children of the parent row.

child - child data of the added row

Example:

dataProvider.onRowAdding = function (provider, row, index, child) {
 if (row > 100) {
 return false;
 }
 return true;
};

onRowCountChanged

Callback notifying that the number of rows has changed

Type - (provider: LocalTreeDataProvider, newCount: number) => void

Remarks:

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

[Parameter list]

provider - TreeDataProvider control

newCount - Number of changed rows

Example:

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

onRowDeleted

Callback notifying that a row has been deleted

Type - (provider: LocalTreeDataProvider, row: number) => void

Remarks:

Called after data is deleted in TreeDataProvider.

If softDeleting = true, it is not called simply because the Row's State is changed to Deleted.

Occurs when the TreeDataProvider is completely deleted.

[Parameter list]

provider - TreeDataProvider control

row - the tree id of the data row

Example:

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

onRowDeleting

A callback that determines row deletion

Type - (provider: LocalTreeDataProvider, row: number) => boolean

Remarks:

Called to TreeDataProvider before data is deleted.

[Parameter list]

provider - TreeDataProvider control

row - the tree id of the data row

Example:

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

onRowParentChanged

Callback notifying that the parent of a row has changed

Type - (provider: LocalTreeDataProvider, row: number, parent: number, index: number) => void

Remarks:

Occurs after the parent is changed using the LocalTreeDataProvider.changeRowParent() function.

[Parameter list]

provider - TreeDataProvider control

row - Tree id of the data row moved

parent - The parent item you moved to

index - location index of the moved parent

Example:

dataProvider.onRowParentChanged = function (provider, row, parent, index) {
 console.log('parent row changed to ' + parent);
};

onRowParentChanging

A callback that determines whether to change the parent of a row

Type - (provider: LocalTreeDataProvider, row: number, parent: number, index: number) => boolean

Remarks:

This occurs when you try to change the parent using the LocalTreeDataProvider.changeRowParent() function.

[Parameter list]

provider - TreeDataProvider control

row - the tree id of the data row you want to move

parent - the parent item you want to move to

index - Position index of the parent you want to move to

Example:

dataProvider.onRowParentChanging = function (provider, row, parent, index) {
 if (row % 2 === 0) {
 return true;
 }
 return false;
};

onRowsAdded

Callback notifying that rows have been added

Type - (provider: LocalTreeDataProvider, parent: number, rows: number[]) => void

Remarks:

Called after data is added to TreeDataProvider.

[Parameter list]

provider - TreeDataProvider control

parent - the id of the parent

rows - tree ids of data rows

Example:

dataProvider.onRowsAdded = function (provider, parent, rows) {
 console.log("DataProvider row added at " + parent + " as " + rows.join(", "));
};

onRowsDeleted

Callback notifying that rows have been deleted

Type - (provider: LocalTreeDataProvider, rows: number[]) => void

Remarks:

Called after data rows are deleted in TreeDataProvider.

[Parameter list]

provider - TreeDataProvider control

rows - tree ids of data rows

Example:

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

onRowSiblingMoved

lineA callback indicating that a sibling has been moved between siblings.

Type - (provider: LocalTreeDataProvider, row: number, offset: number) => void

Remarks:

Called when the position between siblings changes using the LocalTreeDataProvider.moveRowSibling() function.

[Parameter list]

provider - TreeDataProvider control

row - Tree id of the data row moved

offset - upper and lower position step value

Example:

dataProvider.onRowSiblingMoved = function (provider, row, offset) {
 console.log('sibling row moved on: ' + row);
};

onRowSiblingMoving

Callback to determine movement of rows between siblings

Type - (provider: LocalTreeDataProvider, row: number, offset: number) => boolean

Remarks:

LocalTreeDataProvider.moveRowSibling() Called when changing the position between siblings using the function.

[Parameter list]

provider - TreeDataProvider control

row - the tree id of the data row you want to move

offset - upper and lower position step value

Example:

dataProvider.onRowSiblingMoving = function (provider, row, offset) {
 if (row % 2 === 0) {
 return true;
 }
 return false;
};

onRowsSiblingMoved

Callback notifying that siblings have been moved using dragAndDrop

Type - (provider: LocalTreeDataProvider, rows: number[], offset: number) => void

Remarks:

Called when the positions of siblings change using mouse dragAndDrop.

[Parameter list]

provider - TreeDataProvider control

rows - Array of tree ids of the data rows moved

offset - upper and lower position step value

Example:

dataProvider.onRowsSiblingMoved = function (provider, rows, offset) {
 console.log('sibling rows moved on: ' + rows);
};

onRowsSiblingMoving

Callback to determine movement between siblings using DragAndDrop

Type - (provider: LocalTreeDataProvider, rows: number[], offset: number) => boolean

Remarks:

Called when trying to change the position of siblings using mouse dragAndDrop.

[Parameter list]

provider - TreeDataProvider control

rows - array of tree ids for the data rows you want to move

offset - upper and lower position step value

Example:

dataProvider.onRowsSiblingMoving = function (provider, rows, offset) {
 if (rows.length > 1) {
 return false;
 }
 return true;
};

onRowStateChanged

Callback to notify that row state has changed

Type - (provider: LocalTreeDataProvider, row: number) => void

Remarks:

Called after the rowState of the data row of TreeDataProvider is changed.

[Parameter list]

provider - TreeDataProvider control

row - the tree id of the changed data row

Example:

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

onRowStatesChanged

Callback notifying that the state of multiple rows has changed

Type - (provider: LocalTreeDataProvider, rows: number[]) => void

Remarks:

Called after the rowState of multiple data rows is changed in TreeDataProvider.

[Parameter list]

provider - TreeDataProvider control

rows - tree ids of changed data rows

Example:

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

onRowsUpdated

Callback to notify that multiple rows of data have changed

Type - (provider: LocalTreeDataProvider, rows: number[]) => void

Remarks:

This occurs when events are collectively reflected in functions such as updateRows.

[Parameter list]

provider - DataProvider control

rows - Tree ids of changed data rows

Example:

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

onRowsUpdating

Callbacks that determine changes to multiple rows of data

[Parameter list]

provider - DataProvider control

rows - Tree id of the data rows to be changed

Type - (provider: LocalTreeDataProvider, rows: number[]) => boolean

Example:

dataProvider.onRowsUpdating = function (provider, rows) {
 if (rows.length > 10) {
 return false;
 }
 return true;
};

onRowUpdated

Callback notifying that a row has been modified

Type - (provider: LocalTreeDataProvider, row: number) => void

Remarks:

Called before data is modified in TreeDataProvider.

[Parameter list]

provider - TreeDataProvider control

row - the tree id of the data row

Example:

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

onRowUpdating

A callback that determines row modifications

Type - (provider: LocalTreeDataProvider, row: number, oldValues: RowValues, newValues: RowValues) => boolean

Remarks:

Called before data is modified in the TreeDataProvider.

[Parameter List]

provider - TreeDataProvider control

row - Tree id of the data row

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 that notifies that the value of the data has changed.

Type - (provider: LocalTreeDataProvider, row: number, field: number) => void

Remarks:

Call after changing the data using LocalTreeDataProvider.setValue().

[Parameter list]

provider - TreeDataProvider control

row - The tree id of the data row whose value changed.

field - The index of the field.

Example:

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

Method Desc

addChildRow

Adds a child row of the specified tree row.

[Parameter List]

row - number

Tree id of the specified data row. If not specified, the root row is specified.

values - DataValues

Array or Object of field values for the row to add

iconIndex - number

Index of the icon to display in the tree row. Default: -1

hasChildren - boolean

Whether to display the presence of children. Default: false. If true, it is marked as having children.

[return value] - number

Example:

treeProvider.addChildRow(4, ['value1', 'value2', 'value3', 'value4'], -1, true);

changeRowParent

Moves the position of a specific data row to the lower part of the specified row.

[Parameter List]

row - number

Tree id of the data row

parent - number

The id of the specified parent row. Move to the bottom of this row.

index - number

position among brothers

[return value] - boolean

Example:

dataProvider.changeRowParent(4, 1, 2);

clearRows

Delete all rows in DataProvider.

Example:

treeProvider.clearRows();

fillCsvData

Loads csv data according to the specified settings and saves it to the TreeDataProvider local storage.

[Parameter List]

data - any

data in csv format

options - DataFillOptions

Model configuration information, such as DataFillOptions

[Return Value] - void

Example:

let options = {
      start: 1,
      count: 3
}
 
dataProvider.fillCsvData(data, options);

fillJsonData

Loads Json data according to the specified settings and saves it to the TreeDataProvider local storage.

[Parameter List]

data - any

data in json format

options - DataFillOptions

Model configuration information, such as DataFillOptions

[Return Value] - void

Example:

let options = {
      start: 1,
      count: 3
}
 
dataProvider.fillJsonData([
  {
    FieldA: 'ABC';
    FieldB: 10
  }, {
    FieldA: 'DEF';
    FieldB: 30
  }], options);

fillXmlData

Loads xml data according to the specified settings and saves it to the TreeDataProvider local storage.

[Parameter List]

data - any

data in xml format

options - DataFillOptions

Model configuration information, such as DataFillOptions

[Return Value] - void

Example:

let options = {
      start: 1,
      count: 3
}
 
dataProvider.fillXmlData(data, options);

getAncestors

Returns the IDs of ancestor rows of the specified row.

[Parameter List]

row - number

Tree id of the specified data row

[return value] - number[]

Example:

let ances = treeProvider.getAncestors(4);

getChildCount

Returns the number of child rows of the specified row.

[Parameter List]

row - number

Tree id of the specified data row. If -1, the number of child rows of the root row returns

[return value] - number

Example:

let childCount = treeProvider.getChildCount(4);

getChildren

Returns the unique numbers of all child rows of a specified row.

[Parameter List]

row - number

Tree ID of the specified data row, if -1, returns the unique number of child rows of the root row.

[return value] - number[]

Example:

let children = treeProvider.getChildren(4);

getDescendantCount

Returns the number of descendant rows of the specified row.

[Parameter List]

row - number

Tree id of the specified data row, if -1, returns the number of descendant rows of the root row.

[return value] - number

Example:

let descenCount = treeProvider.getDescendantCount(4);

getDescendants

Returns the IDs of descendant rows of the specified row.

[Parameter List]

row - number

maxLevel - number

Maximum level depth that can be returned. Only rows with a level lower than the set value are returned.

[return value] - number[]

Example:

let descendants = treeProvider.getDescendants(4, 2);

getHiddenRows

Returns the numbers of hidden rows.

Example:

let rows = treeProvider.getHiddenRows();

getIconIndex

Returns the index of the icon displayed in the tree row.

[Parameter List]

row - number

Tree id of the data row

[return value] - number

Example:

let iconIndex = treeProvider.getIconIndex(4);

getJsonRow

Returns the specified data row as a JSON object.

[Parameter List]

row - number

Tree id of the specified data row

rowState - boolean

If true, the status value of the row is added.

recursive - boolean

If true, child nodes are included.

childRowsProp - string

Specifies the property name of the child property. Default: 'rows'

iconProp - string

Specifies the attribute name of the icon field. Default: 'iconIndex'

level - number

When including a child node, specify the level calculated by calculating the level of the parentNode to be included as 0. Default: '-1'

[return value] - any

Example:

let jsonRow = treeProvider.getJsonRow(4);

getJsonRows

Returns the specified data row and descendants as a JSON object.

[Parameter List]

row - number

Tree id of the specified data row, if not specified or rowId is specified as null, data from the root row is retrieved.

recursive - boolean

Whether to include descendants. Default: false

childRowsProp - string

Specifies the property name of the child property. Default: 'rows'

iconProp - string

Specifies the attribute name of the icon field. Default: 'iconIndex'

rowState - boolean

If true, the status value of the row is added.

[Return value] - object[]

Example:

let jsonRow = treeProvider.getJsonRows(4, true);

getLevel

Returns the level of the specified row.

[Parameter List]

row - number

Tree id of the specified data row

[return value] - number

Example:

let level = treeProvider.getLevel(4);

getOutputRow

Imports the specified data row as a JSON object by applying the format.

[Parameter List]

options - DataOutputOptions

Setting information for the model, such as DataOutputOptions

row - number

Tree id of the specified data row. If not specified, the result of the root row is returned.

iconProp - string

Specifies the attribute name of the icon field. Default: 'iconIndex'

[return value] - object

Example:

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

getOutputRows

The specified data row and descendants are formatted and imported as a JSON object.

[Parameter List]

options - DataOutputOptions

Setting information for the model, such as DataOutputOptions

row - number

Tree id of the specified data row. If not specified, the result of the root row is returned.

recursive - boolean

Whether to include descendants. Default: false

childRowsProp - string

Specifies the property name of the child property. Default: 'rows'

iconProp - string

Specifies the attribute name of the icon field. Default: 'iconIndex'

[Return value] - object[]

Example:

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

getParent

Returns the row id of the parent of the specified row.

[Parameter List]

row - number

Tree id of the specified data row

[return value] - number

Example:

let p = treeProvider.getParent(4);

getRowCount

Returns the number of stored data rows.

Remarks:

Returns the number of all items stored under the root.

Example:

let rowCount = ds.getRowCount();

getValue

Returns the value of the specified data cell.

[Parameter List]

row - number

Tree id of the data row

field - string | number

Field name or index

[return value] - any

Example:

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

hideRows

Hides the specified row or rows from the screen.

[Parameter List]

dataRows - number[] | number

The row number or numbers you want to hide

[Return Value] - void

Remarks:

If remove or insert occurs in a hidden state, dataRow may change, so be careful when using it.

Example:

// single
treeProvider.hideRows(4);
 
//array
treeProvider.hideRows([3,4]);

insertChildNode

Add a child node to the specified tree row at the desired location.

[Parameter List]

row - number

Tree id of the specified data row. If not specified, the root row is specified.

index - number

The position where the row to be inserted will be placed among the children of the specified parent row.

data - RowObject

data in json format

childrenProp - string

Attribute name if there is a child node

iconField - string

A field containing the index of the icon to display in the tree row.

noState - boolean

Whether to add row status value Default value: false

[return value] - any

Remarks:

Used when adding tree-type data.


insertChildRow

Adds a child row to the desired location among the child rows of the specified tree row.

[Parameter List]

row - number

Tree id of the specified data row. If not specified, the root row is specified.

index - number

The position where the row to be inserted will be placed among the children of the specified parent row.

values - DataValues

A json object with an array of field values or fields as properties.

iconIndex - number

Index of the icon to display in the tree row. Default: -1

hasChildren - boolean

Whether to display the presence of children. Default: false. If true, it is marked as having children.

[return value] - number

Example:

treeProvider.insertChildRow(4, 3, ['value1', 'value2', 'value3', 'value4'], -1, true);

isHiddenRow

Returns whether the specified row is a hidden row.

[Parameter List]

dataRow - number

Unique number of the specified data row

[return value] - boolean

Example:

let isHidden = treeProvider.isHiddenRow(4);

moveRowSibling

The position of a specific data row is moved among siblings of the same parent by a specified number of steps.

[Parameter List]

row - number

Tree id of the data row

offset - number

Specified step value

[return value] - boolean

Example:

dataProvider.moveRowSibling(4, 1);

removeRow

Deletes the specified data row.

[Parameter List]

row - number

Tree id of the data row to delete

recursive - boolean

[return value] - boolean

Remarks:

If the specified data row is an ancestor row, all descendant rows are also deleted. If the DataProvider's softDeleting is true, it is not actually deleted and only the rowState is changed.

Example:

treeProvider.removeRow(4);

removeRows

Deletes specified data rows.

[Parameter List]

rows - number[]

Tree IDs of data rows to delete. If not specified or an empty array is entered, false is returned.

recursive - boolean

[return value] - boolean

Remarks:

If the specified data row is an ancestor row, all descendant rows are also deleted. If the DataProvider's softDeleting is true, it is not actually deleted and only the rowState is changed.

Example:

treeProvider.removeRows([1,3,4]);

resetHiddenRows

Redisplays all hidden rows.

Example:

treeProvider.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', parentId: 3});

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 1:

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

Example 2:

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

setCsvRows

Set the tree data as new CSV data.

[Parameter List]

rows - string

data to set

treeField - string

field name

needSorting - boolean

childrenField - string

Field indicating whether there are child rows

iconField - string

Field name whose value is the path to the icon to be displayed in the tree node.

[Return Value] - void

Remarks:

Delete all existing data rows in the tree and add the CSV passed as a parameter as data rows.

Example:

let rows = `Username; Identifier;First name;Last name
booker12;9012;Rachel;Booker
grey07;2070;Laura;Grey
johnson81;4081;Craig;Johnson
jenkins46;9346;Mary;Jenkins
smith79;5079;Jamie;Smith
`
dataProvider.setCsvRows(rows, 'number', false, '', 'icon');

setIconIndex

Changes the icon of the specified row.

[Parameter List]

row - number

Tree id of the row whose icon you want to change

iconIndex - number

New icon index to change

[Return Value] - void

Example:

treeProvider.setIconIndex(42, 4);

setNestedRows

Set the tree's data to new JSON data.

[Parameter List]

json - any

Data to set. A Json array or an object with a Json array as a property. If it is not a Json array, the property specified in rowsProp must be specified as an array.

rowsProp - string

Property name of array to be used as data rows of tree in Json

childRowsProp - string

If the 1st level array name and the lower level array name are different, the lower level array property name

childrenProp - string

Attribute name indicating whether there is a child row.

iconProp - string

Property name whose value is the path to the icon to be displayed in the tree node.

[Return Value] - void

Remarks:

Delete all existing data rows in the tree and add the JSON object passed as a parameter as data rows. The difference from LocalTreeDataProvider.setObjectRows() is that childrenProp and iconProp do not need to be registered in the field.

Example:

dataProvider.setNestedRows(rows, 'rowsProp', 'childRowsProp', 'childrenProp', 'iconProp');

setObjectRows

Set the tree's data to new JSON data.

[Parameter List]

json - any

Data to set. A Json array or an object with a Json array as a property. If it is not a Json array, the property specified in rowsProp must be specified as an array.

rowsProp - string

In Json, a property name whose value is an array to be used as data rows in a tree.

childrenProp - string

Attribute name indicating whether there are child rows. The value of the property must be the same as the child's field name.

iconProp - string

Property name whose value is the path to the icon to be displayed in the tree node.

[Return Value] - void

Remarks:

Delete all existing data rows in the tree and add the JSON object passed as a parameter as data rows.

Example:

dataProvider.setObjectRows(rows, 'rowsProp', 'childField', 'iconField');

setRows

Set the tree data as new data.

[Parameter List]

rows - DataValues[]

data to set

treeField - string

field name

needSorting - boolean

childrenField - string

Field indicating whether there are child rows

iconField - string

Field name whose value is the path to the icon to be displayed in the tree node.

[Return Value] - void

Remarks:

Delete all existing data rows in the tree and add the array of arrays passed as parameters as data rows.

Example:

dataProvider.setRows([{
          'uno', 1, 'one', 'ichi', 'ee', 'I'
      }, {
          'dos', 2, 'two', 'ni', 'er', 'II'
      }
], 'number', false, '', 'icon');

setValue

Changes the value of a specified data cell.

[Parameter List]

row - number

Tree id of the data row

field - string | number

Field name or index

value - any

[Return Value] - void

Example:

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

setXmlRows

Set the tree data as new XML data.

[Parameter List]

xml - any

data to set

rowElement - string

The name of the element to be used as data rows in the XML tree

childrenField - string

Field indicating whether there is a child row, the child field name

iconField - string

Field name whose value is the path to the icon to be displayed in the tree node.

[Return Value] - void

Remarks:

Delete all existing data rows in the tree and add the XML passed as a parameter as data rows. If you enter "row" in rowElement, the row element of the root will be used, and if you enter "row[0].row" in rowElement, the first row of the root will be used. "row.row" is equivalent to "row[0].row".

Example:

dataProvider.setXmlRows(rows, 'number', false, '', 'icon');

showHiddenRows

Shows hidden rows or rows on the screen.

[Parameter List]

dataRows - number[] | number

The row number or numbers you want to show

[Return Value] - void

Remarks:

If filterMode, sortMode:"explicit" is used, the filter or sort will be reapplied if showHiddenRows() is used. It is displayed in a collapsed state.

Example:

// single
treeProvider.showHiddenRows(4);
 
//array
treeProvider.showHiddenRows([3,4]);

updateRow

Modifies field values of the specified data row.

[Parameter List]

row - number

Tree id of the specified data row

values - DataValues

Change value. It is an array of field values, an array, or a json object.

strict - boolean

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

[return value] - boolean

Example:

treeProvider.updateRow(4, ['value1', 'value2', 'value3', 'value4'], true);

updateRows

Modifies field values of specified data rows.

[Parameter List]

rows - number[]

Array of tree ids for the specified data row

values - DataValues[]

Change value. It is an array of field values, an array, or a json object.

strict - boolean

If true, fields whose values are undefined or not specified retain their existing values.

[Return Value] - void

Example:

treeProvider.updateRows([4,3], [{field1: 'value1', field2: 'value2', field2: 'value3', field4: 'value4'}, {field1: 'val1'}], true);