Initializer
$(".selector").recordView(options)
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | A map of option-value pairs to set on the widget. |
- Since:
- 5.1
Example
Create a xxx.
HTML:
<div class="a-GV-columnItemContainer u-vh" aria-hidden="true">
<div class="u-vh" aria-hidden="true">
<div class="a-GV-columnItem">column item markup goes here</div>
...
</div>
Extends
Options
actionsContext :actions
Actions context to use. If not provided a new context is created. Specifying a context allows this widget to be contained within another one and share the same context.
Type:
alwaysEdit :boolean
Only applies if editable is true. If true, the recordView will start out in edit mode and double click, enter, and escape will not change the mode. Calling setEditMode(false) can still change the edit mode.
Type:
- boolean
- Default Value:
- false
autoAddRecord :boolean
Specifies if a new record should be automatically added when the model doesn't contain any data. If supported by the derived view a new record may be added when moving beyond the last record in the view while editing. Must only be true if the model and view are editable and the model allows adding records.
Type:
- boolean
- Inherited From:
- Default Value:
- false
editable :boolean
Determine if the view allows editing. This is independent of the model editability. If true the view data can be edited according to what the model allows. Only applies if the view supports editing.
Type:
- boolean
- Inherited From:
- Default Value:
- false
fieldGroups :xxx
Type:
- xxx
fields :Array.<object>
Defines the fields in the model and recordView form. The value is an array of exactly one object that maps the field name to a field definition object. The properties are the field names. The property value is a field definition. Wrapping the object in an array simply keeps the widget from making a copy of the fields so that the same definition can be shared.
The same structure can be shared with the view model and a grid widget.
Type:
- Array.<object>
Properties:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
* |
object | The property is the field name. By convention
it is the uppercase database column name. The value is an object that defines the field.
All properties are optional unless specified otherwise.
Properties
|
footer :boolean
Determine if the view will include a footer to show status and pagination controls and information. If true a footer is shown at the bottom of the view. If false no footer is shown.
Type:
- boolean
- Inherited From:
- Default Value:
- true
hasSize :boolean
This affects scrolling and how any header (if the view has a header) or footer position is handled.
Set to true if the view is in a container that has a specific height defined. When hasSize is true the record content will scroll within the bounds of the region.
Set to false if the view does not have a defined height. The view height will be as large as needed to contain the view records as determined by pagination settings. The view may scroll within the browser window. Other options may control if the header (if the view has a header) or footer sticks to the window.
The container width must always be defined.
Type:
- boolean
- Inherited From:
- Default Value:
- false
hideDeletedRows :boolean
Determine if deleted rows (records) are removed from the view right away or shown with a strike through effect to indicate they are going to be deleted. If true (and the view is editable) deleted records will not be visible, otherwise they are visible but have a visual indication that they are deleted. The actual records are not deleted on the server until the model is saved.
Type:
- boolean
- Inherited From:
- Default Value:
- false
highlights :object
Defines highlight color information for the view. Only applies to views that support highlighting. Style rules are injected into the document based on the highlight object.
The object is a mapping of highlight id to color definition.
Type:
- object
Properties:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
* |
object | A highlight ID. A unique ID for the highlight rule. The object can contain
any number of highlight rules. The model record or field highlight metadata (see model.RecordMetadata)
is used to associate the model data with the highlight rule. One of color or background must be given.
Properties
|
- Inherited From:
idPrefix :string
The prefix to use when generating ids. To avoid duplicate element ids either give the widget element an id or specify this property.
Type:
- string
modelName :string
Name of model that this view widget will display data from. Can include an instance as well. The model must already exist. This option is required.
Type:
- string
- Inherited From:
noDataMessage :string
Text to display when there is no data.
Type:
- string
- Inherited From:
pagination :object
Pagination settings.
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
scroll |
boolean | If true the scroll bar is used to page through the results a.k.a infinite scrolling or virtual paging. If false then next and previous buttons are shown. Default is false. |
loadMore |
boolean | If true show a load more button rather than auto paging. Only applies if scroll is true and the model doesn't know the total rows. Default is false. |
showPageLinks |
boolean | If true show page links between buttons. Only applies if scroll is false The model must know the total number of rows for this to be true. Default is false. |
maxLinks |
number | The maximum number of links to show when showPageLinks is true. Default is 5. |
showPageSelector |
boolean | If true show a drop down page selector between the buttons. Only applies if scroll is false. The model must know the total number of rows for this to be true. Default is false. |
showRange |
boolean | If true the range of rows/records is shown. It is shown between the buttons unless showPageLinks or showPageSelector is true. The range is shown as "X to Y" if the model doesn't know the total rows and "X to Y of Z" if the model does know the total number of rows. Default is true. |
firstAndLastButtons |
boolean | Only applies if scroll is false. If true first and last buttons are included. For this to be true the model must know the total number of rows. |
- Inherited From:
progressOptions :object
Options object to pass to apex.util.showSpinner. The default depends on the hasSize option.
Type:
- object
- Inherited From:
- Default Value:
- { fixed: !options.hasSize }
recordOffset :interger
Zero based index of record in model to display/edit in this recordView.
Type:
- interger
rowsPerPage :boolean|null
Determine how many rows to show in one page. Only applies if pagination.scroll is false, otherwise this value is ignored. If null this value is determined by the viewport height
Type:
- boolean | null
- Inherited From:
- Default Value:
- null
selectionStatusMessageKey :string
The text message key to use for showing the number of selected rows/records in the footer. The message key must have exactly one parameter %0 which is replaced with the number of rows/records selected.
Type:
- string
- Inherited From:
- Default Value:
- "APEX.GV.SELECTION_COUNT"
showNullAs :string
Text to display when the value is null or empty string.
Type:
- string
- Default Value:
- "-"
skipDeletedRecords :boolean
If true (and the recordView is editable) deleted records/rows will skipped over; the next non-deleted record is shown. Otherwise they are visible but have a visual indication that they are deleted this has no effect if the model deletes records right away.
Type:
- boolean
- Default Value:
- false
stickyFooter :boolean
Determine if the footer will stick to the bottom of the page. Only applies if hasSize is false and footer is true. If false the footer will not stick to the bottom of the page. If true the footer will stick to the bottom of the page.
Type:
- boolean
- Inherited From:
- Default Value:
- false
toolbar :object
Toolbar options. A default toolbar is provided. If null then there will be no toolbar.
Type:
- object
Methods
fieldElement(pFieldName) → {*}
Parameters:
Name | Type | Description |
---|---|---|
pFieldName |
field/column name |
Returns:
- Type
- *
focus()
getActions() → {actions}
Returns:
- Type
- actions
Example
var a = $("#myview").recordView("getActions");
a.toggle("exclude-null-values");
a.invoke("next-record");
a.invoke("delete-record");
// to get a list of all actions from the browser javascript console
console.log(JSON.stringify($("#myview").recordView("getActions").list(), null, 4));
getActiveRecord() → {model.record}
Returns the active record or null if there is no active record. The active record is the one currently being edited.
- Inherited From:
Returns:
- Type
- model.record
getActiveRecordId() → {string}
Returns the identity of the active record or null if there is no active record. The active record is the one currently being edited.
- Inherited From:
Returns:
- Type
- string
getRecord() → {Object|Array}
Returns:
- Type
- Object | Array
getToolbar() → {jQuery}
Returns:
- Type
- jQuery
gotoField(pRecordId, pColumnopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pRecordId |
String | the record id of the record to go to. | |
pColumn |
String |
<optional> |
column name of the field to go to. |
inEditMode() → {Boolean}
Returns:
- Type
- Boolean
lockActive()
Call to lock the active row while async processing is in progress.
The view edits one row/record at a time. This is known as the active row. In edit mode as the user changes the focused cell with the mouse, tab or enter keys if the new cell is on a different row the previous row is deactivated and the new row is activated. Any dynamic actions or other code that manipulates Column items are acting on the active row. If any actions are asynchronous such as using ajax to set a column item value then the row must not be deactivated while the async action is in progress otherwise the result would be applied to the wrong row!
So this method must be called before starting an async operation. It can be called multiple times if there are multiple async operations. For each call to lockActive there must be exactly one call to unlockActive.
If the view is part of an APEX region plugin, that region should implement the beforeAsync and afterAsync functions on the object returned from region.getSessionState by calling lockActive and unlockActive respectively. Then if an appropriate target option is passed to apex.server.plugin then the locking will be done automatically. Dynamic Actions that act on column items pass the correct target option. The bottom line is that for Dynamic Actions on columns of an Interactive Grid these lock/unlock methods are called automatically.
- Inherited From:
refresh(pFocusopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pFocus |
boolean |
<optional> |
if true put focus in the recordView |
refreshFields()
resize()
setActiveRecordValue(pColumn)
Use after a column item value is set without triggering a change event to update the model and grid view. Has no effect if there is no active record.
todo improve docParameters:
Name | Type | Description |
---|---|---|
pColumn |
string | The name of the column. |
- Inherited From:
setEditMode(pEditMode)
Parameters:
Name | Type | Description |
---|---|---|
pEditMode |
boolean | if true enter edit mode if false enter navigation mode |
unlockActive()
Call to unlock the active row after async processing is complete.
Call after the async operation completes. See tableModelViewBase#lockActive for more information.
- Inherited From: