Constructor
new RowSet(rows, options)
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
rows |
Array |
<optional> |
Set of row objects or JS array of data to put into rowSet at construction time |
options |
Object |
<optional> |
Passed through to the user's initialize routine, if any, upon construction |
- Source:
- ojdatacollection-common/RowSet.js, line 12
Fields
-
<static> _ROW_STATUSES :string
-
- Source:
- ojdatacollection-common/RowSet.js, line 282
Properties:
Name Type Default Description _ADDED
string added _DELETED
string deleted _UPDATED
string updated _NONE
string none -
<static> EventType :string
-
- Source:
- ojdatacollection-common/RowSet.js, line 251
Properties:
Name Type Default Description ADD
string add Triggered when a Row is added to a RowSet REMOVE
string remove Triggered when a Row is removed from a RowSet RESET
string reset Triggered when a RowSet is reset (see oj.RowSet.reset) SORT
string sort Triggered when a RowSet is sorted CHANGE
string change Triggered when a Row's attributes are changed DESTROY
string destroy Triggered when a Row is deleted from the data service (and thus from its RowSet) REQUEST
string request Triggered when a Row or RowSet has sent a request to the data service SYNC
string sync Triggered when a Row or RowSet has been updated from the data service ERROR
string error Triggered when a Row has failed to update on the data service INVALID
string invalid Triggered when a Row being saved has been invalidated by the caller ALL
string all Triggered for any of the above events -
comparator :String|function(Object)|function(Object,Object)
-
If set, sort the rowSet using the given attribute of a row (if string); function(Row) returning a string attribute by which the sort should take place; function(Row1, Row2) if a user-defined function comparing Row1 and Row2 (see the JavaScript array.sort() for details)
- Source:
- ojdatacollection-common/RowSet.js, line 26
-
sortSupported :boolean
-
Set to true if sort is supported.
- Source:
- ojdatacollection-common/RowSet.js, line 34
Methods
-
_handleEvent(eventType, event)
-
Handle the event
Parameters:
Name Type Description eventType
string event type event
? event - Source:
- ojdatacollection-common/RowSet.js, line 233
-
at(index, options) → {Object}
-
Return the Row object found at the given index of the RowSet, or a promise object that will return the Row to a function in the done() call.
Parameters:
Name Type Argument Description index
number Index for which to return the Row object. options
Object <optional>
fetchSize: fetch size to use if the call needs to fetch more records from the server, if virtualized. Overrides the overall fetchSize setting
deferred: if true, return a deferred/promise object as described below. If not specified, the return value will be determined by whether or not the RowSet is virtual
- Source:
- ojdatacollection-common/RowSet.js, line 78
Returns:
Row object located at index. If index is out of range, returns null. If this is a paging/virtual RowSet or if deferred is specified and true, at will return a jQuery promise object which will call its done function, passing the value at(index)- Type
- Object
-
#fetch(options)
-
Loads the data into the RowSet
Parameters:
Name Type Argument Description options
Object <optional>
Options to control fetch - Source:
- ojdatacollection-common/RowSet.js, line 93
Throws:
- Type
- Error
-
get(id, options) → {Object}
-
Return the first Row object from the RowSet whose Row id value is the given id Note this method will not function as expected if the id is not set
Parameters:
Name Type Argument Description id
Object | string ID for which to return the Row object, if found. options
Object <optional>
fetchSize: fetch size to use if the call needs to fetch more records from the server, if virtualized. Overrides the overall fetchSize setting
deferred: if true, return a promise as though this RowSet were virtual whether it is or not
- Source:
- ojdatacollection-common/RowSet.js, line 109
Returns:
First Row object in the RowSet where Row.id = id. If none are found, returns null. If deferred or virtual, return a promise passing the Row when done- Type
- Object
-
hasMore() → {boolean}
-
- Source:
- ojdatacollection-common/RowSet.js, line 120
Returns:
whether there is more data- Type
- boolean
-
indexOf(row, options) → {number}
-
Return the array index location of the given Row object.
Parameters:
Name Type Argument Description row
Object Row object to locate options
Object <optional>
deferred: if true, return a promise as though this RowSet were virtual whether it is or not - Source:
- ojdatacollection-common/RowSet.js, line 135
Returns:
The index of the given Row object, or a promise that will call with the index when complete. If the object is not found, returns -1.- Type
- number
-
isEmpty() → {boolean}
-
- Source:
- ojdatacollection-common/RowSet.js, line 147
Returns:
true if RowSet is empty- Type
- boolean
-
off(eventType, eventHandler)
-
Detach an event handler from the datasource
Parameters:
Name Type Description eventType
string eventType supported by the datasource eventHandler
function(Object) event handler function - Source:
- ojdatacollection-common/RowSet.js, line 213
-
#oj.ArrayRowSet#fetch(options)
-
Loads the data into the RowSet
Parameters:
Name Type Argument Description options
Object <optional>
Options to control fetch - Source:
- ojdatacollection-common/ArrayRowSet.js, line 181
Throws:
- Type
- Error
-
on(eventType, eventHandler)
-
Attach an event handler to the datasource
Parameters:
Name Type Description eventType
string eventType supported by the datasource eventHandler
function(Object) event handler function - Source:
- ojdatacollection-common/RowSet.js, line 190
-
size() → {number}
-
- Source:
- ojdatacollection-common/RowSet.js, line 158
Returns:
length of the RowSet- Type
- number
-
sort()
-
- Source:
- ojdatacollection-common/RowSet.js, line 168
-
totalSize() → {number}
-
- Source:
- ojdatacollection-common/RowSet.js, line 178
Returns:
length of the RowSet- Type
- number