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 a ListGrid that defines the following fields:
fields : [ {name: "field1"}, {name: "field2"} ],Might have the following data:
data : [ {field1: "foo", field2: "bar", customProperty:5}, {field1: "field1 value", field2: "field2 value", enabled:false} ]Each line of code in the
data
array above creates one JavaScript Object via
JavaScript {type:ObjectLiteral,object literal} notation. These JavaScript Objects are
used as ListGridRecords.
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.
After a ListGrid is created and has loaded data, records may be accessed via
ListGrid.data
, for example, listGrid.data.get(0) retrieves the
first record.
ListGridRecords are also passed to many events, such as
cellClick()
.
A ListGridRecord is always an ordinary JavaScript Object regardless of how the grid's dataset is loaded (static data, java server, XML web service, etc), and so supports the normal behaviors of JavaScript Objects, including accessing and assigning to properties via dot notation:
var fieldValue = record.fieldName; record.fieldName = newValue;
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.
com.smartgwt.client.widgets.grid.ListGrid#getData
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.
|
void |
set_baseStyle(java.lang.String _baseStyle)
Name of a CSS style to use as the
ListGrid.baseStyle for
all cells for this particular record. |
void |
set_canEdit(java.lang.Boolean _canEdit)
Default property name denoting whether this record can be edited.
|
void |
set_canRemove(java.lang.Boolean _canRemove)
Default property name denoting whether this record can be removed.
|
void |
setBackgroundComponent(Canvas backgroundComponent)
Has no effect unless
ListGrid.showBackgroundComponents is true . |
void |
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. |
void |
setCanDrag(java.lang.Boolean canDrag)
When set to
false , this record cannot be dragged. |
void |
setCanExpand(java.lang.Boolean canExpand)
Default property name denoting whether this record can be expanded.
|
void |
setCanSelect(java.lang.Boolean canSelect)
Default property name denoting whether this record can be selected.
|
void |
setCustomStyle(java.lang.String customStyle)
Name of a CSS style to use for all cells for this particular record.
|
void |
setDetailDS(DataSource detailDS)
The default value of
ListGrid.recordDetailDSProperty . |
void |
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. |
void |
setEmbeddedComponentFields(java.lang.String... embeddedComponentFields)
Fields where the
embeddedComponent will be
displayed, if specified. |
void |
setEmbeddedComponentPosition(EmbeddedPosition embeddedComponentPosition)
Sizing policy applied to the embedded component.
|
void |
setEnabled(java.lang.Boolean enabled)
Default property name denoting whether this record is enabled.
|
void |
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. |
void |
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. |
void |
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. |
void |
setIsSeparator(java.lang.Boolean isSeparator)
Default property name denoting a separator row.
When set to true , defines a horizontal separator in the
listGrid object. |
void |
setLinkText(java.lang.String linkText)
The HTML to display in this row for fields with fieldType set to link.
|
void |
setShowRollOver(java.lang.Boolean showRollOver)
Set to false to disable rollover for this individual record when
ListGrid.showRollOver is true. |
void |
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, 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 void 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 nullCSSStyleName
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 void set_canEdit(java.lang.Boolean _canEdit)
ListGrid.recordEditProperty
._canEdit
- New _canEdit value. Default value is nullEditing overview and related methods
public java.lang.Boolean get_canEdit()
ListGrid.recordEditProperty
.Editing overview and related methods
public void set_canRemove(java.lang.Boolean _canRemove)
ListGrid.recordCanRemoveProperty
._canRemove
- New _canRemove value. Default value is nullEditing overview and related methods
public java.lang.Boolean get_canRemove()
ListGrid.recordCanRemoveProperty
.Editing overview and related methods
public void 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 nullpublic 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 void 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 nullpublic java.lang.Boolean getCanAcceptDrop()
false
, other records cannot be dropped on (i.e., inserted via drag and drop) immediately before
this record.public void 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 nullpublic 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 void setCanExpand(java.lang.Boolean canExpand)
ListGrid.canExpandRecordProperty
.canExpand
- New canExpand value. Default value is nullpublic java.lang.Boolean getCanExpand()
ListGrid.canExpandRecordProperty
.public void setCanSelect(java.lang.Boolean canSelect)
ListGrid.recordCanSelectProperty
.canSelect
- New canSelect value. Default value is nullpublic java.lang.Boolean getCanSelect()
ListGrid.recordCanSelectProperty
.public void 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 nullCSSStyleName
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 void setDetailDS(DataSource detailDS)
ListGrid.recordDetailDSProperty
.
Note : This is an advanced setting
detailDS
- New detailDS value. Default value is nullpublic DataSource getDetailDS()
ListGrid.recordDetailDSProperty
.public void 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 nullAppearance 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 void 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 nullAppearance 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 void 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 accomodate the embedded components'
specified sizes instead.embeddedComponentPosition
- New embeddedComponentPosition value. Default value is nullAppearance 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 accomodate the embedded components'
specified sizes instead.Appearance overview and related methods
public void setEnabled(java.lang.Boolean enabled)
ListGrid.recordEnabledProperty
.enabled
- New enabled value. Default value is nullpublic java.lang.Boolean getEnabled()
ListGrid.recordEnabledProperty
.public void 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 nullpublic 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 void 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 falsepublic 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 void 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 falsepublic 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 void 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 nullpublic 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 void setLinkText(java.lang.String linkText)
ListGridField.linkText
.linkText
- New linkText value. Default value is nullListGridFieldType
,
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 void 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 nullAppearance 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 void setSingleCellValue(java.lang.String singleCellValue)
ListGrid.singleCellValueProperty
.singleCellValue
- New singleCellValue value. Default value is nullHTMLString
public java.lang.String getSingleCellValue()
ListGrid.singleCellValueProperty
.HTMLString