DataTable

Overview

DataTable is a basic dataset object. It contains an array of rows containing the actual data, and also maintains information about any changes that may have been made to these rows locally, but that have not yet been sent back to the server.

Creation

Calling RemoteDataAdapter.createTableFromSchema

var tbl = new RemObjects.DataAbstract.DataTable();
rda.createTableFromSchema("someTable", tbl, function() {
    alert("created table structure");
});

Passing requestInfo.includeSchema = true.

var tbl = new RemObjects.DataAbstract.DataTable("someTable");
rda.getData(tbl, RemObjects.DataAbstract.Util.createRequestInfo(true, -1, "", []), function() {
    alert("got data");
});

DataTable supports common next/prev/first/last/eof/bof methods.

while (!tbl.eof()) {
    tbl.setFieldValue("someField", someValue);
    tbl.next();
}

Accessing data

tbl.setFieldValue("someField", someValue);
alert(tbl.getFieldValue("someField");

Location

DataAbstract.js

 

constructor DataTable

Creates new DataTable object

function constructor DataTable(aName)

Parameters:

  • aName: string

addLookupField

Adds read-only lookup field to the table.

function addLookupField(aName, aSourceField, aLookupTable, aLookupKeyField, aLookupResultField)

Parameters:

  • aName: string
  • aSourceField: string
  • aLookupTable: DataTable
  • aLookupKeyField: string
  • aLookupResultField: string

appendRow

Returns new row.

function appendRow()

bof

Returns true when:

  • cursor is on the first record and prev() method was called
  • first() was called
function bof()

bofFlag

Internal flag.

bofFlag

cancel beta

Cancels current editing operation and reverts field values to the previous state.

function cancel()

currentRow

Returns current row.

function currentRow()

deletedRows

Internal list of deleted rows.

deletedRows

deleteRow

Deletes current row.

function deleteRow()

dynamicWhere

Assign prepared DynamicWhere instance to this field before retrieving the data.

dynamicWhere

eof

Returns true when:

  • cursor is on the last record and next() method was called
  • last() method was called
function eof()

eofFlag

Internal flag.

eofFlag

fieldByName

Returns field value.

function fieldByName(aName)

Parameters:

  • aName: string

fieldNumByName

Returns Field number.

function fieldNumByName(aName)

Parameters:

  • aName: string

fields

List of fields.

fields

findId

Returns row with the specified Id or null if not found.

function findId(anId)

Parameters:

  • anId: number

first

Moves cursor to the first row.

function first()

getFieldAsString

Returns Field value as a string.

function getFieldAsString(aField)

Parameters:

  • aField: string

getFieldValue

Returns Field value.

function getFieldValue(aField)

Parameters:

  • aField: string

getNextId

Returns next row Id. Used internally.

function getNextId()

intFindDeleted

Used internally.

function intFindDeleted(anId)

Parameters:

  • anId: number

keyfields

array of strings

keyfields

last

Moves cursor to the last row.

function last()

locate

Sets cursor to the row where value of the field aName equals aValue and returns true. If not found, returns false.

function locate(aName, aValue)

Parameters:

  • aName: string
  • aValue: object

markDeleted

Used internally.

function markDeleted()

name

DataTable name.

name

Moves cursor to the next row.

function next()

onAfterDelete

If set, this callback is fired after delete command. Takes row as a parameter.

onAfterDelete

onAfterScroll

If set, this callback is fired after any navigation command. Takes row as a parameter.

onAfterScroll

onBeforeDelete

If set, this callback is fired before delete operation. Takes row as a parameter.

onBeforeDelete

onBeforeScroll

If set, this callback is fired before any navigation operation. Takes row as a parameter.

onBeforeScroll

onNewRecord

If set, this callback is fired on adding new row. Takes row as a parameter.

onNewRecord

post beta

Finishes editing and posts changed values from inner buffer to current row.

function post()

Moves cursor to the previous row.

function prev()

rows

List of DataTable rows.

rows

setFieldAsString

Sets field value as a string.

function setFieldAsString(aField, aValue)

Parameters:

  • aField: string
  • aValue: string

setFieldValue

Sets field value.

function setFieldValue(aField, aValue)

Parameters:

  • aField: string
  • aValue: object

 

bofFlag

Internal flag.

bofFlag

deletedRows

Internal list of deleted rows.

deletedRows

dynamicWhere

Assign prepared DynamicWhere instance to this field before retrieving the data.

dynamicWhere

eofFlag

Internal flag.

eofFlag

fields

List of fields.

fields

keyfields

array of strings

keyfields

name

DataTable name.

name

onAfterDelete

If set, this callback is fired after delete command. Takes row as a parameter.

onAfterDelete

onAfterScroll

If set, this callback is fired after any navigation command. Takes row as a parameter.

onAfterScroll

onBeforeDelete

If set, this callback is fired before delete operation. Takes row as a parameter.

onBeforeDelete

onBeforeScroll

If set, this callback is fired before any navigation operation. Takes row as a parameter.

onBeforeScroll

onNewRecord

If set, this callback is fired on adding new row. Takes row as a parameter.

onNewRecord

rows

List of DataTable rows.

rows

 

constructor DataTable

Creates new DataTable object

function constructor DataTable(aName)

Parameters:

  • aName: string

addLookupField

Adds read-only lookup field to the table.

function addLookupField(aName, aSourceField, aLookupTable, aLookupKeyField, aLookupResultField)

Parameters:

  • aName: string
  • aSourceField: string
  • aLookupTable: DataTable
  • aLookupKeyField: string
  • aLookupResultField: string

appendRow

Returns new row.

function appendRow()

bof

Returns true when:

  • cursor is on the first record and prev() method was called
  • first() was called
function bof()

cancel beta

Cancels current editing operation and reverts field values to the previous state.

function cancel()

currentRow

Returns current row.

function currentRow()

deleteRow

Deletes current row.

function deleteRow()

eof

Returns true when:

  • cursor is on the last record and next() method was called
  • last() method was called
function eof()

fieldByName

Returns field value.

function fieldByName(aName)

Parameters:

  • aName: string

fieldNumByName

Returns Field number.

function fieldNumByName(aName)

Parameters:

  • aName: string

findId

Returns row with the specified Id or null if not found.

function findId(anId)

Parameters:

  • anId: number

first

Moves cursor to the first row.

function first()

getFieldAsString

Returns Field value as a string.

function getFieldAsString(aField)

Parameters:

  • aField: string

getFieldValue

Returns Field value.

function getFieldValue(aField)

Parameters:

  • aField: string

getNextId

Returns next row Id. Used internally.

function getNextId()

intFindDeleted

Used internally.

function intFindDeleted(anId)

Parameters:

  • anId: number

last

Moves cursor to the last row.

function last()

locate

Sets cursor to the row where value of the field aName equals aValue and returns true. If not found, returns false.

function locate(aName, aValue)

Parameters:

  • aName: string
  • aValue: object

markDeleted

Used internally.

function markDeleted()

Moves cursor to the next row.

function next()

post beta

Finishes editing and posts changed values from inner buffer to current row.

function post()

Moves cursor to the previous row.

function prev()

setFieldAsString

Sets field value as a string.

function setFieldAsString(aField, aValue)

Parameters:

  • aField: string
  • aValue: string

setFieldValue

Sets field value.

function setFieldValue(aField, aValue)

Parameters:

  • aField: string
  • aValue: object