Rows

Row Methods

Name

Description

distinctArray(column)

Returns an array of distinct values in column.

insert(rows, first?)

Inserts rows into a data table. If first is passed in, the rows are inserted at the top of the Rows array.

join(table)

Joins a data table with a second table using an inner join. Visit DataTables Inner Joins for examples.

leftJoin(table)

Joins a data table with a second table using a left join. Visit DataTables Left Join for examples.

newRow

Returns a new rows with the same schema as the existing rows. All values are set to null.

replace(keyName, keyValue, row)

Replaces the row with the column value keyValue in the column name keyName with the row passed in.

Delete Row Methods

Use the following methods to delete rows from a data table.

Name

Description

eq(column, value)

Deletes the rows where the column column is value.

ne(column, value)

Deletes the rows where the column column does not equalvalue.

filter(function)

Deletes rows using a custom function. As the function is evaluated, it will receive the current row, index position, and the list of all rows as delegate parameters.

The following deletes all rows where UserName is apeters.

table.delete().eq("UserName", "apeters");

Update Row Methods

Use the following methods to update the values of rows in a data table.

Name

Description

update(column)

Starts an update method chain for a column in a data table.

value(value)

Sets the value of the column passed in the update method to value.

filter(function)

Sets the value of the column passed in the update method using a custom function. As the function is evaluated, it will receive the current row, index position, and the list of all rows as delegate parameters.

The first example below sets the Active column to false for all rows. The second example sets the Active column to false only for UserName apeters. It is otherwise set to true.

table.update("Active").value(false);

...

table.update("Active").filter((row, index, rows) => {
    return (row.UserName == "apeters") ? false :  true;
});

Visit DataTable Rows for detailed examples of using row data table methods.

Last updated