Class: GentableGridRowModel

documents.sdk.gentable.grid GentableGridRowModel

Constructors

Extends

Methods

getNumber(columnName, decimalSeparator, groupingSeparator){Number}

Returns the value of the given column as a number.
If the optional parameters decimalSeparator and groupingSeparator are not set, this method will use localized values by default.

Name Type Description
columnName String

the name of the column

decimalSeparator String optional

the decimal separator

groupingSeparator String optional

the grouping separator

  • Since:
    • 5.0a
Returns:
Type Description
Number the value of the given column
Example
documentsContext.getGentableContext().getGridModel().getRow(1).getNumber("amount", ".", ",");

index(){Number}

Returns the current index of the row.

  • Since:
    • 5.0a
Returns:
Type Description
Number the current row index

isVisible(){Boolean}

Returns if the row is visible or not.

  • Since:
    • 5.0a
Returns:
Type Description
Boolean true if the row is visible, false otherwise

reload(){Promise}

Reloads the current row and returns a Promise for the reload process to be completed.
Notice that reloading a row implies an full AJAX request/response to/from the server behind the scenes which is always performed asynchronously.
As a result, any code following a reload() statement will be executed immediately while not waiting the reload process to be completed.
Code can be synchronized with the returned Promise object which lets you provide a callback function that is called when the Promise is fulfilled.

  • Since:
    • 5.0a
Returns:
Type Description
Promise the Promise that is fulfilled when the reload process is complete
Example
var gridModel = documentsContext.getGentableContext().getGridModel();
var row = gridModel.addRow();

row.reload().then( function() {
  console.log("reload process complete");
});

 //  caution: code following "row.reload()" is invoked immediately

toJSON(){Object}

Returns a (shallow) copy of the entire row for JSON serialization.
For example this method can be used for persistence, serialization or augmentation before being sent to the server.

Returns:
Type Description
Object the row json clone
Example
var gridModel = documentsContext.getGentableContext().getGridModel();
var row = gridModel.getRow(0);
var rowJson = row.toJSON();
console.log( JSON.stringify(rowJson) );  //  ->  "{"departure":{"city":"Sydney","IATA":"SYD","overdue":true},"primes":[2,3,5,7,11,13,17,19,23],"pi":3.14159265359}"