Banana.Document.Table

Diese Dokumentation ist veraltet

Die umfangreichste und aktuellste Dokumentation ist die von Banana Buchhaltung Plus : Probieren Sie es sofort aus!

In this article

Banana.Document.Table is the interface of a table.

Properties

name

Return the xml name of the table.

columnNames

Return the xml names of the table's columns as an array.

headers

Return the xml names of the table's columns as an array.

Deprecated since 7.0.5.0, use instead columns

isValid

Return true if the object is valid.

Deprecated since 7.0.7.0

rowCount

Return the number of rows in the table.

rows

Return the rows of the table as an array of Row objects.

Methods

addMessage(msg, rowNr [, columnName])

Add the message msg to the queue of the document. The message is showed in the pane "Messages", and in a dialog if the application option "Show Messages" is turned on.

If rowNr is different than "-1" the message is connected to the row rowNr. if columnName is not empty, the message is connected to the column columnName. With a double click over message in the message pane, the cursor jump to the corresponding table, rowNr and columnName.

See also: Application.AddMessageRow.AddMessage, Document.AddMessage.

extractRows( function(rowObj, rowNr, table), tableTitle)

Extract the rows that passed the test defined by function and show them in the table "Selections". The title of the table is set to tableTitle.

Introduced in 7.0.2.0

findRows( function(rowObj, rowNr, table))

Return an array of Row objects that pass the test defined in function.

findRowByValue(columnName, value)

Return the first row as Row object that contains the value in the the column columnName. Or undefined if any row is found.

var cashAccountRow = Banana.document.table('Accounts').findRowByValue('Account','1000');
if (!cashAccountRow)
   //Row not found

Introduced in 7.0.2.0

row(rowNr)

Return the Row at index rownr as Row Object, or undefined if rowNr si outside the valid range.

toHtml([columnNames, formatValues])

Return the table as Html file. If the parameter columnNames is defined, only the columns in the array are included in the file. If formatValues is set to true, the values are converted to the locale format.

Example:

//Show the whole row content of the table Accounts
Banana.Ui.showText(Banana.document.table('Accounts').toHtml());

//Show some columns and format dates, amounts, ... as displayed in the program
Banana.Ui.showText(
   Banana.document.table('Accounts').toHtml(['Account','Group','Description','Balance'],true)
);

Introduced in 7.0.5.0

toTsv([columnNames])

Return the table as Tsv file (Tab separated values). If the parameter columnNames is defined, only the columns in the array are included in the file.

Introduced in 7.0.5.0

value(rowNr, columnName)

Return the value in row rowNr and column columnName as string. Or undefined if the row or column are not found.