public class ListGridRecord extends Record
ListGridField
. A ListGridRecord may have additional properties
which affect the record's appearance or behavior, or which hold data for use by custom logic
or other, related components.
For example, if a ListGrid is getting its ListGridFields from the following DataSource definition:
<DataSource ... > <fields> <field name="field1" ... /> <field name="field2" ... /> </fields> </DataSource>It might have the following data:
data : [ {field1: "foo", field2: "bar", customProperty:5}, {field1: "field1 value", field2: "field2 value", enabled:false} ]The sample data shown above is in JSON format, and might be how data is returned from a REST web service.
Both records shown above have properties whose names match the name property of a
ListGridField, as well as additional properties. The second record will be disabled due to
enabled:false
; the first record has a property "customProperty" which will
have no effect by default but which may be accessed by custom logic.
The same records could be constructed in Java like so:
ListGridRecord records[] = new ListGridRecord[2]; records[0] = new ListGridRecord(); records[0].setAttribute("field1", "foo"); records[0].setAttribute("field2", "bar"); records[0].setAttribute("customProperty", 5); records[1] = new ListGridRecord(); records[1].setAttribute("field1", "field1 value"); records[1].setAttribute("field2", "field2 value"); records[1].setAttribute("enabled", false); RecordList recordList = new RecordList(); recordList.addList(records);
After a ListGrid is created and has loaded data, records may be accessed via
ListGrid.getDataAsRecordList()
,
which will return a ResultSet
(a subclass of
RecordList
) if the listGrid is bound to a DataSource.
ListGridRecords are also passed to many events, such as
cellClick()
.
A ListGridRecord is a wrapper around an ordinary JavaScript Object regardless of how the grid's dataset is loaded (static data, java server, XML web service, etc), where you have access to its properties via setAttribute() and getAttribute() methods:
record.setAttribute("field1", "foo"); String value1 = record.getAttribute("field1");
Note however that simply assigning a value to a record won't cause the display to be
automatically refreshed - ListGrid.refreshCell()
needs to
be called. Also,
consider editValues vs saved values
when directly modifying
ListGridRecords.
See the attributes in the API tab for the full list of special properties on ListGridRecords that will affect the grid's behavior.
id
factoryCreated, factoryProperties
Constructor and Description |
---|
ListGridRecord() |
ListGridRecord(com.google.gwt.core.client.JavaScriptObject jsObj) |
ListGridRecord(Record record)
Convenience constructor to build a ListGridRecord from a Record.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
get_baseStyle()
Name of a CSS style to use as the
ListGrid.baseStyle for
all cells for this particular record. |
java.lang.Boolean |
get_canEdit()
Default property name denoting whether this record can be edited.
|
java.lang.Boolean |
get_canRemove()
Default property name denoting whether this record can be removed.
|
Canvas |
getBackgroundComponent()
Has no effect unless
ListGrid.showBackgroundComponents is true . |
java.lang.Boolean |
getCanAcceptDrop()
When set to
false , other records cannot be dropped on (i.e., inserted via drag and drop) immediately before
this record. |
java.lang.Boolean |
getCanDrag()
When set to
false , this record cannot be dragged. |
java.lang.Boolean |
getCanExpand()
Default property name denoting whether this record can be expanded.
|
java.lang.Boolean |
getCanSelect()
Default property name denoting whether this record can be selected.
|
java.lang.String |
getCustomStyle()
Name of a CSS style to use for all cells for this particular record.
|
DataSource |
getDetailDS()
The default value of
ListGrid.recordDetailDSProperty . |
Canvas |
getEmbeddedComponent()
A component that should be rendered on top of this record, similar to a
record component but statically defined on the
record. |
java.lang.String[] |
getEmbeddedComponentFields()
Fields where the
embeddedComponent will be
displayed, if specified. |
EmbeddedPosition |
getEmbeddedComponentPosition()
Sizing policy applied to the embedded component.
|
java.lang.Boolean |
getEnabled()
Default property name denoting whether this record is enabled.
|
java.lang.Boolean |
getIncludeInSummary()
If specified as false this record should be ignored when calculating summary totals to be shown in the
summary row for this grid. |
java.lang.Boolean |
getIsGridSummary()
This attribute will automatically be set to true for the record representing the grid-level summary row shown if
ListGrid.showGridSummary is true. |
java.lang.Boolean |
getIsGroupSummary()
This attribute will automatically be set to true for records representing group-level summary rows shown if
ListGrid.showGroupSummary is true. |
java.lang.Boolean |
getIsSeparator()
Default property name denoting a separator row.
When set to true , defines a horizontal separator in the
listGrid object. |
java.lang.String |
getLinkText()
The HTML to display in this row for fields with fieldType set to link.
|
static ListGridRecord |
getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj) |
java.lang.Boolean |
getShowRollOver()
Set to false to disable rollover for this individual record when
ListGrid.showRollOver is true. |
java.lang.String |
getSingleCellValue()
Default property name denoting the single value to display for all fields of this row.
|
ListGridRecord |
set_baseStyle(java.lang.String _baseStyle)
Name of a CSS style to use as the
ListGrid.baseStyle for
all cells for this particular record. |
ListGridRecord |
set_canEdit(java.lang.Boolean _canEdit)
Default property name denoting whether this record can be edited.
|
ListGridRecord |
set_canRemove(java.lang.Boolean _canRemove)
Default property name denoting whether this record can be removed.
|
ListGridRecord |
setBackgroundComponent(Canvas backgroundComponent)
Has no effect unless
ListGrid.showBackgroundComponents is true . |
ListGridRecord |
setCanAcceptDrop(java.lang.Boolean canAcceptDrop)
When set to
false , other records cannot be dropped on (i.e., inserted via drag and drop) immediately before
this record. |
ListGridRecord |
setCanDrag(java.lang.Boolean canDrag)
When set to
false , this record cannot be dragged. |
ListGridRecord |
setCanExpand(java.lang.Boolean canExpand)
Default property name denoting whether this record can be expanded.
|
ListGridRecord |
setCanSelect(java.lang.Boolean canSelect)
Default property name denoting whether this record can be selected.
|
ListGridRecord |
setCustomStyle(java.lang.String customStyle)
Name of a CSS style to use for all cells for this particular record.
|
ListGridRecord |
setDetailDS(DataSource detailDS)
The default value of
ListGrid.recordDetailDSProperty . |
ListGridRecord |
setEmbeddedComponent(Canvas embeddedComponent)
A component that should be rendered on top of this record, similar to a
record component but statically defined on the
record. |
ListGridRecord |
setEmbeddedComponentFields(java.lang.String... embeddedComponentFields)
Fields where the
embeddedComponent will be
displayed, if specified. |
ListGridRecord |
setEmbeddedComponentPosition(EmbeddedPosition embeddedComponentPosition)
Sizing policy applied to the embedded component.
|
ListGridRecord |
setEnabled(java.lang.Boolean enabled)
Default property name denoting whether this record is enabled.
|
ListGridRecord |
setIncludeInSummary(java.lang.Boolean includeInSummary)
If specified as false this record should be ignored when calculating summary totals to be shown in the
summary row for this grid. |
ListGridRecord |
setIsGridSummary(java.lang.Boolean isGridSummary)
This attribute will automatically be set to true for the record representing the grid-level summary row shown if
ListGrid.showGridSummary is true. |
ListGridRecord |
setIsGroupSummary(java.lang.Boolean isGroupSummary)
This attribute will automatically be set to true for records representing group-level summary rows shown if
ListGrid.showGroupSummary is true. |
ListGridRecord |
setIsSeparator(java.lang.Boolean isSeparator)
Default property name denoting a separator row.
When set to true , defines a horizontal separator in the
listGrid object. |
ListGridRecord |
setLinkText(java.lang.String linkText)
The HTML to display in this row for fields with fieldType set to link.
|
ListGridRecord |
setShowRollOver(java.lang.Boolean showRollOver)
Set to false to disable rollover for this individual record when
ListGrid.showRollOver is true. |
ListGridRecord |
setSingleCellValue(java.lang.String singleCellValue)
Default property name denoting the single value to display for all fields of this row.
|
convertToRecordArray, copyAttributes, copyAttributesInto, getAttributeAsRecordArray, getAttributeAsRecordList, getPaletteDefaults, isARecord, toMap
getRef, getRef, internalSetID
applyFactoryProperties, doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsDoubleArray, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, isFactoryCreated, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributeAsJavaObject, setFactoryCreated
public ListGridRecord()
public ListGridRecord(com.google.gwt.core.client.JavaScriptObject jsObj)
public ListGridRecord(Record record)
record
- existing JavaScriptObject wrapperpublic static ListGridRecord getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
public ListGridRecord set_baseStyle(java.lang.String _baseStyle)
ListGrid.baseStyle
for
all cells for this particular record. The styleName specified with have suffixes appended to it as the record
changes state ("Over", "Selected" and so forth) as described by ListGrid.getCellStyle()
. For a single, fixed style for a
record, use customStyle
instead.
See ListGrid.getCellStyle()
for an overview of various ways to
customize styling, both declarative and programmatic.
If this property is changed after draw(), to refresh the grid
call ListGrid.refreshRow()
(or ListGrid.markForRedraw()
if several rows are being refreshed).
If your application's data uses the "_baseStyle" attribute for something else, the property name can be changed via
ListGrid.recordBaseStyleProperty
.
_baseStyle
- New _baseStyle value. Default value is nullListGridRecord
instance, for chaining setter callsCSSStyleName
public java.lang.String get_baseStyle()
ListGrid.baseStyle
for
all cells for this particular record. The styleName specified with have suffixes appended to it as the record
changes state ("Over", "Selected" and so forth) as described by ListGrid.getCellStyle()
. For a single, fixed style for a
record, use customStyle
instead.
See ListGrid.getCellStyle()
for an overview of various ways to
customize styling, both declarative and programmatic.
If this property is changed after draw(), to refresh the grid
call ListGrid.refreshRow()
(or ListGrid.markForRedraw()
if several rows are being refreshed).
If your application's data uses the "_baseStyle" attribute for something else, the property name can be changed via
ListGrid.recordBaseStyleProperty
.
CSSStyleName
public ListGridRecord set_canEdit(java.lang.Boolean _canEdit)
ListGrid.recordEditProperty
._canEdit
- New _canEdit value. Default value is nullListGridRecord
instance, for chaining setter callsGrid Editing
public java.lang.Boolean get_canEdit()
ListGrid.recordEditProperty
.Grid Editing
public ListGridRecord set_canRemove(java.lang.Boolean _canRemove)
ListGrid.recordCanRemoveProperty
._canRemove
- New _canRemove value. Default value is nullListGridRecord
instance, for chaining setter callsGrid Editing
public java.lang.Boolean get_canRemove()
ListGrid.recordCanRemoveProperty
.Grid Editing
public ListGridRecord setBackgroundComponent(Canvas backgroundComponent)
ListGrid.showBackgroundComponents
is true
. Canvas created and embedded in the body behind a given
record. When set, either as a Canvas or Canvas Properties, will be constructed if necessary, combined with the
autoChild properties specified for ListGrid.backgroundComponent
and displayed behind this record in the page's z-order, meaning it will only be visible if
the cell styling is transparent.
backgroundComponent
- New backgroundComponent value. Default value is nullListGridRecord
instance, for chaining setter callspublic Canvas getBackgroundComponent()
ListGrid.showBackgroundComponents
is true
. Canvas created and embedded in the body behind a given
record. When set, either as a Canvas or Canvas Properties, will be constructed if necessary, combined with the
autoChild properties specified for ListGrid.backgroundComponent
and displayed behind this record in the page's z-order, meaning it will only be visible if
the cell styling is transparent.
public ListGridRecord setCanAcceptDrop(java.lang.Boolean canAcceptDrop)
false
, other records cannot be dropped on (i.e., inserted via drag and drop) immediately before
this record.canAcceptDrop
- New canAcceptDrop value. Default value is nullListGridRecord
instance, for chaining setter callspublic java.lang.Boolean getCanAcceptDrop()
false
, other records cannot be dropped on (i.e., inserted via drag and drop) immediately before
this record.public ListGridRecord setCanDrag(java.lang.Boolean canDrag)
false
, this record cannot be dragged. If canDrag is false for any record in the current
selection, none of the records will be draggable.canDrag
- New canDrag value. Default value is nullListGridRecord
instance, for chaining setter callspublic java.lang.Boolean getCanDrag()
false
, this record cannot be dragged. If canDrag is false for any record in the current
selection, none of the records will be draggable.public ListGridRecord setCanExpand(java.lang.Boolean canExpand)
ListGrid.canExpandRecordProperty
.canExpand
- New canExpand value. Default value is nullListGridRecord
instance, for chaining setter callspublic java.lang.Boolean getCanExpand()
ListGrid.canExpandRecordProperty
.public ListGridRecord setCanSelect(java.lang.Boolean canSelect)
ListGrid.recordCanSelectProperty
.canSelect
- New canSelect value. Default value is nullListGridRecord
instance, for chaining setter callspublic java.lang.Boolean getCanSelect()
ListGrid.recordCanSelectProperty
.public ListGridRecord setCustomStyle(java.lang.String customStyle)
Note that using this property assigns a single,
fixed style to the record, so rollover and selection styling are disabled. To provide a series of stateful styles for a
record use _baseStyle
instead.
See ListGrid.getCellStyle()
for an overview of various ways to
customize styling, both declarative and programmatic.
If this property is changed after draw(), to refresh the grid
call ListGrid.refreshRow()
(or ListGrid.markForRedraw()
if several rows are being refreshed).
If your application's data uses the "customStyle" attribute for something else, the property name can be changed via
ListGrid.recordCustomStyleProperty
.
customStyle
- New customStyle value. Default value is nullListGridRecord
instance, for chaining setter callsCSSStyleName
public java.lang.String getCustomStyle()
Note that using this property assigns a single,
fixed style to the record, so rollover and selection styling are disabled. To provide a series of stateful styles for a
record use _baseStyle
instead.
See ListGrid.getCellStyle()
for an overview of various ways to
customize styling, both declarative and programmatic.
If this property is changed after draw(), to refresh the grid
call ListGrid.refreshRow()
(or ListGrid.markForRedraw()
if several rows are being refreshed).
If your application's data uses the "customStyle" attribute for something else, the property name can be changed via
ListGrid.recordCustomStyleProperty
.
CSSStyleName
public ListGridRecord setDetailDS(DataSource detailDS)
ListGrid.recordDetailDSProperty
.
Note : This is an advanced setting
detailDS
- New detailDS value. Default value is nullListGridRecord
instance, for chaining setter callspublic DataSource getDetailDS()
ListGrid.recordDetailDSProperty
.public ListGridRecord setEmbeddedComponent(Canvas embeddedComponent)
record component
but statically defined on the
record. The embedded component will default to covering all fields of the record, but specific fields can be
specified via embeddedComponentFields
.
By default, the embeddedComponent will fill the entire vertical and horizontal space of
the record (or of the specified fields). embeddedComponentPosition
can be set to
control exact sizing behavior.
When a record with an embeddedComponent
is eliminated from view by
filtering or because it is not currently rendered due to incremental rendering
, the ListGrid may Canvas.hide()
or Canvas.clear()
it.
If the current dataset is completely replaced (by a call to ListGrid.setData()
or ListGrid.setDataSource()
, for example), any embedded component
is deparented
(which implies being clear()ed
).
When a ListGrid is destroyed
, it will destroy() all embedded components regardless of whether
they are currently visible. Use a call to ListGrid.setData()
immediately before destroying the ListGrid to avoid this effect when unwanted.
For more advanced control over the
lifecycle of components displayed over records, including deferred creation and pooling, use the record components
subsystem.
embeddedComponent
- New embeddedComponent value. Default value is nullListGridRecord
instance, for chaining setter callsAppearance overview and related methods
public Canvas getEmbeddedComponent()
record component
but statically defined on the
record. The embedded component will default to covering all fields of the record, but specific fields can be
specified via embeddedComponentFields
.
By default, the embeddedComponent will fill the entire vertical and horizontal space of
the record (or of the specified fields). embeddedComponentPosition
can be set to
control exact sizing behavior.
When a record with an embeddedComponent
is eliminated from view by
filtering or because it is not currently rendered due to incremental rendering
, the ListGrid may Canvas.hide()
or Canvas.clear()
it.
If the current dataset is completely replaced (by a call to ListGrid.setData()
or ListGrid.setDataSource()
, for example), any embedded component
is deparented
(which implies being clear()ed
).
When a ListGrid is destroyed
, it will destroy() all embedded components regardless of whether
they are currently visible. Use a call to ListGrid.setData()
immediately before destroying the ListGrid to avoid this effect when unwanted.
For more advanced control over the
lifecycle of components displayed over records, including deferred creation and pooling, use the record components
subsystem.
Appearance overview and related methods
public ListGridRecord setEmbeddedComponentFields(java.lang.String... embeddedComponentFields)
embeddedComponent
will be
displayed, if specified. Regardless of the order of fields specified, the component will appear from whichever field is earlier in the current visible order to whichever field is later, inclusive of the specified fields.
To have the component appear in just one field, either specify a single-element Array or specific a two element Array with both fields the same.
If either field is hidden or invalid (no such field), the component will occupy only a single field. If both fields are hidden, the component will be hidden until one or more of the fields are shown.
embeddedComponentFields
- New embeddedComponentFields value. Default value is nullListGridRecord
instance, for chaining setter callsAppearance overview and related methods
public java.lang.String[] getEmbeddedComponentFields()
embeddedComponent
will be
displayed, if specified. Regardless of the order of fields specified, the component will appear from whichever field is earlier in the current visible order to whichever field is later, inclusive of the specified fields.
To have the component appear in just one field, either specify a single-element Array or specific a two element Array with both fields the same.
If either field is hidden or invalid (no such field), the component will occupy only a single field. If both fields are hidden, the component will be hidden until one or more of the fields are shown.
Appearance overview and related methods
public ListGridRecord setEmbeddedComponentPosition(EmbeddedPosition embeddedComponentPosition)
EmbeddedPosition
"within" (fill space allocated to the record, including the ability use
percentage sizing and snapTo offset). Use "expand" to have the record expand to accommodate the embedded components'
specified sizes instead.embeddedComponentPosition
- New embeddedComponentPosition value. Default value is nullListGridRecord
instance, for chaining setter callsAppearance overview and related methods
public EmbeddedPosition getEmbeddedComponentPosition()
EmbeddedPosition
"within" (fill space allocated to the record, including the ability use
percentage sizing and snapTo offset). Use "expand" to have the record expand to accommodate the embedded components'
specified sizes instead.Appearance overview and related methods
public ListGridRecord setEnabled(java.lang.Boolean enabled)
ListGrid.recordEnabledProperty
.enabled
- New enabled value. Default value is nullListGridRecord
instance, for chaining setter callspublic java.lang.Boolean getEnabled()
ListGrid.recordEnabledProperty
.public ListGridRecord setIncludeInSummary(java.lang.Boolean includeInSummary)
summary row
for this grid. Note that
includeInSummary
is the default property name for this attribute, but it may be modified via ListGrid.includeInSummaryProperty
.
includeInSummary
- New includeInSummary value. Default value is nullListGridRecord
instance, for chaining setter callspublic java.lang.Boolean getIncludeInSummary()
summary row
for this grid. Note that
includeInSummary
is the default property name for this attribute, but it may be modified via ListGrid.includeInSummaryProperty
.
public ListGridRecord setIsGridSummary(java.lang.Boolean isGridSummary)
ListGrid.showGridSummary
is true. Note that
isGridSummary
is the default property name for this attribute but it may be modified by setting ListGrid.gridSummaryRecordProperty
isGridSummary
- New isGridSummary value. Default value is falseListGridRecord
instance, for chaining setter callspublic java.lang.Boolean getIsGridSummary()
ListGrid.showGridSummary
is true. Note that
isGridSummary
is the default property name for this attribute but it may be modified by setting ListGrid.gridSummaryRecordProperty
public ListGridRecord setIsGroupSummary(java.lang.Boolean isGroupSummary)
ListGrid.showGroupSummary
is true. Note that
isGroupSummary
is the default property name for this attribute but it may be modified by setting ListGrid.groupSummaryRecordProperty
isGroupSummary
- New isGroupSummary value. Default value is falseListGridRecord
instance, for chaining setter callspublic java.lang.Boolean getIsGroupSummary()
ListGrid.showGroupSummary
is true. Note that
isGroupSummary
is the default property name for this attribute but it may be modified by setting ListGrid.groupSummaryRecordProperty
public ListGridRecord setIsSeparator(java.lang.Boolean isSeparator)
true
, defines a horizontal separator in the
listGrid object. Typically this is specified as the only property of a record object, since a record with
isSeparator:true
will not display any values.ListGrid.isSeparatorProperty
.isSeparator
- New isSeparator value. Default value is nullListGridRecord
instance, for chaining setter callspublic java.lang.Boolean getIsSeparator()
true
, defines a horizontal separator in the
listGrid object. Typically this is specified as the only property of a record object, since a record with
isSeparator:true
will not display any values.ListGrid.isSeparatorProperty
.public ListGridRecord setLinkText(java.lang.String linkText)
ListGridField.linkText
.linkText
- New linkText value. Default value is nullListGridRecord
instance, for chaining setter callsListGridFieldType
,
FieldType
,
ListGridField.setLinkText(java.lang.String)
,
ListGrid.setLinkTextProperty(java.lang.String)
public java.lang.String getLinkText()
ListGridField.linkText
.ListGridFieldType
,
FieldType
,
ListGridField.getLinkText()
,
ListGrid.getLinkTextProperty()
public ListGridRecord setShowRollOver(java.lang.Boolean showRollOver)
ListGrid.showRollOver
is true. Note this property can be
renamed to prevent collision with data members - see ListGrid.recordShowRollOverProperty
.
showRollOver
- New showRollOver value. Default value is nullListGridRecord
instance, for chaining setter callsAppearance overview and related methods
public java.lang.Boolean getShowRollOver()
ListGrid.showRollOver
is true. Note this property can be
renamed to prevent collision with data members - see ListGrid.recordShowRollOverProperty
.
Appearance overview and related methods
public ListGridRecord setSingleCellValue(java.lang.String singleCellValue)
ListGrid.singleCellValueProperty
.singleCellValue
- New singleCellValue value. Default value is nullListGridRecord
instance, for chaining setter callsHTMLString
public java.lang.String getSingleCellValue()
ListGrid.singleCellValueProperty
.HTMLString