JSDataSet
Property Summary
Methods Summary
Type | Name | Summary |
---|---|---|
adds a column with the specified name to the dataset.. | ||
adds a column with the specified name to the dataset.. | ||
adds a column with the specified name to the dataset.. | ||
void | Add an HTML property to an HTML tag produced in getAsHTML().. | |
void | Add a row to the dataset.. | |
void | Add a row to the dataset.. | |
Create a datasource from the data set with specified name and using specified types.. | ||
Create a datasource from the data set with specified name and using specified types.. | ||
Create a datasource from the data set with specified name and using specified types.. | ||
Get the dataset as an html table, do not escape values or spaces, no multi_line_markup, do not add indentation, add column names.. | ||
Get the dataset as an html table, do not escape spaces, no multi_line_markup, do not add indentation, add column names.. | ||
Get the dataset as an html table, no multi_line_markup, do not add indentation, add column names.. | ||
Get the dataset as an html table, do not add indentation, add column names.. | ||
Get the dataset as an html table, add column names.. | ||
Get the dataset as an html table.. | ||
Get the dataset as formatted text.. | ||
Get the column data of a dataset as an Array.. | ||
Get a column name based on index.. | ||
Get the column names of a dataset.. | ||
Get a column type based on index.. | ||
Get the database exception if an error occurred.. | ||
Get the number of columns in the dataset.. | ||
Get the number of rows in the dataset.. | ||
Get the row data of a dataset as an Array.. | ||
Get the value specified by row and column position from the dataset.. | ||
Return true if there is more data in the resultset then specified by maxReturnedRows at query time.. | ||
Remove a column by index from the dataset.. | ||
void | Remove a row from the dataset.. | |
void | Set a column name based on index.. | |
void | Set the value specified by row and column position from the dataset.. | |
void | Sort the dataset on the given column (1-based) in ascending or descending.. | |
void | Sort the dataset using the function as comparator.. |
Properties Details
rowIndex
Get or set the record index of the dataset.
Returns Number
Sample
Methods Details
addColumn(name)
adds a column with the specified name to the dataset.
Parameters String name column name.
Returns Boolean true if succeeded, else false.
Sample
addColumn(name, index)
adds a column with the specified name to the dataset.
Parameters String name column name. Number index column index number between 1 and getMaxColumnIndex().
Returns Boolean true if succeeded, else false.
Sample
addColumn(name, index, type)
adds a column with the specified name to the dataset.
Parameters String name column name. Number index column index number between 1 and getMaxColumnIndex(). Number type the type of column, see JSColumn constants.
Returns Boolean true if succeeded, else false.
Sample
addHTMLProperty(row, col, name, value)
Add an HTML property to an HTML tag produced in getAsHTML().
For row and col parameters use: 1 = applies to the container 0 = applies to all
0 = applies to specific cell
Parameters Number row row number Number col column number String name String property name String value String property value
Returns void
Sample
addRow(index, array)
Add a row to the dataset.
Parameters Number index index to add row (1-based) Array array row data
Returns void
Sample
addRow(array)
Add a row to the dataset. The row will be added as the last row.
Parameters Array array row data
Returns void
Sample
createDataSource(name)
Create a datasource from the data set with specified name and using specified types. The types are inferred from the data if possible.
A temporary datasource cannot be removed because once created there may always be forms or relations that refer to it. When the client exits, all datasources used by that client are removed automatically.
Most resources used by the datasource can be released by deleting all records: dataset.removeRow(-1) or databaseManager.getFoundSet(datasource).deleteAllRecords()
Parameters String name datasource name
Returns String String uri reference to the created datasource.
Sample
createDataSource(name, types)
Create a datasource from the data set with specified name and using specified types.
A temporary datasource cannot be removed because once created there may always be forms or relations that refer to it. When the client exits, all datasources used by that client are removed automatically.
Most resources used by the datasource can be released by deleting all records: dataset.removeRow(-1) or databaseManager.getFoundSet(datasource).deleteAllRecords()
A datasource can be reused if the data has the same signature (column names and types). A new createDataSource() call will clear the datasource contents from a previous call and insert the current data.
Parameters String name datasource name Object types array of types as defined in JSColumn
Returns String String uri reference to the created datasource.
Sample
createDataSource(name, types, pkNames)
Create a datasource from the data set with specified name and using specified types.
A temporary datasource cannot be removed because once created there may always be forms or relations that refer to it. When the client exits, all datasources used by that client are removed automatically.
Most resources used by the datasource can be released by deleting all records: dataset.removeRow(-1) or databaseManager.getFoundSet(datasource).deleteAllRecords()
Parameters String name datasource name Object types array of types as defined in JSColumn, when null types are inferred from the query result Array pkNames array of pk names, when null a hidden pk-column will be added
Returns String String uri reference to the created datasource.
Sample
getAsHTML()
Get the dataset as an html table, do not escape values or spaces, no multi_line_markup, do not add indentation, add column names.
Returns String String html.
Sample
getAsHTML(escape_values)
Get the dataset as an html table, do not escape spaces, no multi_line_markup, do not add indentation, add column names.
Parameters Boolean escape_values if true, replaces illegal HTML characters with corresponding valid escape sequences.
Returns String String html.
Sample
getAsHTML(escape_values, escape_spaces)
Get the dataset as an html table, no multi_line_markup, do not add indentation, add column names.
Parameters Boolean escape_values if true, replaces illegal HTML characters with corresponding valid escape sequences. Boolean escape_spaces if true, replaces text spaces with non-breaking space tags ( ) and tabs by four non-breaking space tags.
Returns String String html.
Sample
getAsHTML(escape_values, escape_spaces, multi_line_markup)
Get the dataset as an html table, do not add indentation, add column names.
Parameters Boolean escape_values if true, replaces illegal HTML characters with corresponding valid escape sequences. Boolean escape_spaces if true, replaces text spaces with non-breaking space tags ( ) and tabs by four non-breaking space tags. Boolean multi_line_markup if true, multiLineMarkup will enforce new lines that are in the text; single new lines will be replaced by , multiple new lines will be replaced by
Returns String String html.
Sample
getAsHTML(escape_values, escape_spaces, multi_line_markup, pretty_indent)
Get the dataset as an html table, add column names.
Parameters Boolean escape_values if true, replaces illegal HTML characters with corresponding valid escape sequences. Boolean escape_spaces if true, replaces text spaces with non-breaking space tags ( ) and tabs by four non-breaking space tags. Boolean multi_line_markup if true, multiLineMarkup will enforce new lines that are in the text; single new lines will be replaced by , multiple new lines will be replaced by
Boolean pretty_indent if true, adds indentation for more readable HTML code.
Returns String String html.
Sample
getAsHTML(escape_values, escape_spaces, multi_line_markup, pretty_indent, add_column_names)
Get the dataset as an html table.
Parameters Boolean escape_values if true, replaces illegal HTML characters with corresponding valid escape sequences. Boolean escape_spaces if true, replaces text spaces with non-breaking space tags ( ) and tabs by four non-breaking space tags. Boolean multi_line_markup if true, multiLineMarkup will enforce new lines that are in the text; single new lines will be replaced by , multiple new lines will be replaced by
Boolean pretty_indent if true, adds indentation for more readable HTML code. Boolean add_column_names if false, column headers will not be added to the table.
Returns String String html.
Sample
getAsText(column_separator, row_separator, value_delimiter, add_column_names)
Get the dataset as formatted text.
Parameters String column_separator any specified column separator; examples: tab '\t'; comma ','; semicolon ';'; space ' ' . String row_separator the specified row separator; examples: new line '\n'. String value_delimiter the specified value delimiter; null means empty string; example: double quote '"'. Boolean add_column_names if true column names will be added as a first row.
Returns String String formatted text.
Sample
getColumnAsArray(index)
Get the column data of a dataset as an Array.
Parameters Number index index of column (1-based).
Returns Array Object array of data.
Sample
getColumnName(index)
Get a column name based on index.
Parameters Number index index of column (1-based).
Returns String String column name.
Sample
getColumnNames()
Get the column names of a dataset.
Returns Array String[] column names
Sample
getColumnType(index)
Get a column type based on index.
Parameters Number index index of column (1-based).
Returns Number Number the column type (JSColumn constant)
Sample
getException()
Get the database exception if an error occurred.
Returns Exception ServoyException exception or null when not available.
Sample
getMaxColumnIndex()
Get the number of columns in the dataset.
Returns Number int number of columns.
Sample
getMaxRowIndex()
Get the number of rows in the dataset.
Returns Number int number of rows.
Sample
getRowAsArray(index)
Get the row data of a dataset as an Array.
Parameters Number index index of row (1-based).
Returns Array Object array of data.
Sample
getValue(row, col)
Get the value specified by row and column position from the dataset.
Parameters Number row row number, 1-based Number col column number, 1-based
Returns Object Object value
Sample
hadMoreData()
Return true if there is more data in the resultset then specified by maxReturnedRows at query time.
Returns Boolean boolean more data available
Sample
removeColumn(index)
Remove a column by index from the dataset.
Parameters Number index index of column to remove (1-based)
Returns Boolean true if succeeded, else false.
Sample
removeRow(row)
Remove a row from the dataset.
Parameters Number row row index to remove, -1 for all rows
Returns void
Sample
setColumnName(index, columnName)
Set a column name based on index.
Parameters Number index index of column (1-based). String columnName new column name.
Returns void
Sample
setValue(row, col, obj)
Set the value specified by row and column position from the dataset. Use row = -1, to set columnnames.
Parameters Number row row number, 1-based Number col column number, 1-based Object obj the value to be stored at the given row and column.
Returns void
Sample
sort(col, sort_direction)
Sort the dataset on the given column (1-based) in ascending or descending.
Parameters Number col column number, 1-based Boolean sort_direction ascending (true) or descending (false)
Returns void
Sample
sort(comparator)
Sort the dataset using the function as comparator. The comparator function is called to compare two rows, that are passed as arguments, and it will return -1/0/1 if the first row is less/equal/greater then the second row.
NOTE: starting with 7.2 release, when called on datasource(foundset) dataset, this function doesn't save the data anymore
Parameters Function comparator comparator function
Returns void
Sample
Last updated