Class ListGridRecord
- All Implemented Interfaces:
HasHandlers
- Direct Known Subclasses:
CellRecord
,GroupSummary
,MenuItem
,TreeNode
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.
-
Field Summary
Fields inherited from class com.smartgwt.client.core.RefDataClass
id
Fields inherited from class com.smartgwt.client.core.DataClass
factoryCreated, factoryProperties
-
Constructor Summary
ConstructorDescriptionListGridRecord
(JavaScriptObject jsObj) ListGridRecord
(Record record) Convenience constructor to build a ListGridRecord from a Record. -
Method Summary
Modifier and TypeMethodDescriptionName of a CSS style to use as theListGrid.baseStyle
for all cells for this particular record.Default property name denoting whether this record can be edited.Default property name denoting whether this record can be removed.Has no effect unlessListGrid.showBackgroundComponents
istrue
.When set tofalse
, other records cannot be dropped on (i.e., inserted via drag and drop) immediately before this record.When set tofalse
, this record cannot be dragged.Default property name denoting whether this record can be expanded.Default property name denoting whether this record can be selected.Name of a CSS style to use for all cells for this particular record.The default value ofListGrid.recordDetailDSProperty
.A component that should be rendered on top of this record, similar to arecord component
but statically defined on the record.String[]
Fields where theembeddedComponent
will be displayed, if specified.Sizing policy applied to the embedded component.Default property name denoting whether this record is enabled.If specified as false this record should be ignored when calculating summary totals to be shown in thesummary row
for this grid.This attribute will automatically be set to true for the record representing the grid-level summary row shown ifListGrid.showGridSummary
is true.This attribute will automatically be set to true for records representing group-level summary rows shown ifListGrid.showGroupSummary
is true.Default property name denoting a separator row.
When set totrue
, defines a horizontal separator in the listGrid object.The HTML to display in this row for fields with fieldType set to link.static ListGridRecord
getOrCreateRef
(JavaScriptObject jsObj) Set to false to disable rollover for this individual record whenListGrid.showRollOver
is true.Default property name denoting the single value to display for all fields of this row.set_baseStyle
(String _baseStyle) Name of a CSS style to use as theListGrid.baseStyle
for all cells for this particular record.set_canEdit
(Boolean _canEdit) Default property name denoting whether this record can be edited.set_canRemove
(Boolean _canRemove) Default property name denoting whether this record can be removed.setBackgroundComponent
(Canvas backgroundComponent) Has no effect unlessListGrid.showBackgroundComponents
istrue
.setCanAcceptDrop
(Boolean canAcceptDrop) When set tofalse
, other records cannot be dropped on (i.e., inserted via drag and drop) immediately before this record.setCanDrag
(Boolean canDrag) When set tofalse
, this record cannot be dragged.setCanExpand
(Boolean canExpand) Default property name denoting whether this record can be expanded.setCanSelect
(Boolean canSelect) Default property name denoting whether this record can be selected.setCustomStyle
(String customStyle) Name of a CSS style to use for all cells for this particular record.setDetailDS
(DataSource detailDS) The default value ofListGrid.recordDetailDSProperty
.setEmbeddedComponent
(Canvas embeddedComponent) A component that should be rendered on top of this record, similar to arecord component
but statically defined on the record.setEmbeddedComponentFields
(String... embeddedComponentFields) Fields where theembeddedComponent
will be displayed, if specified.setEmbeddedComponentPosition
(EmbeddedPosition embeddedComponentPosition) Sizing policy applied to the embedded component.setEnabled
(Boolean enabled) Default property name denoting whether this record is enabled.setIncludeInSummary
(Boolean includeInSummary) If specified as false this record should be ignored when calculating summary totals to be shown in thesummary row
for this grid.setIsGridSummary
(Boolean isGridSummary) This attribute will automatically be set to true for the record representing the grid-level summary row shown ifListGrid.showGridSummary
is true.setIsGroupSummary
(Boolean isGroupSummary) This attribute will automatically be set to true for records representing group-level summary rows shown ifListGrid.showGroupSummary
is true.setIsSeparator
(Boolean isSeparator) Default property name denoting a separator row.
When set totrue
, defines a horizontal separator in the listGrid object.setLinkText
(String linkText) The HTML to display in this row for fields with fieldType set to link.setShowRollOver
(Boolean showRollOver) Set to false to disable rollover for this individual record whenListGrid.showRollOver
is true.setSingleCellValue
(String singleCellValue) Default property name denoting the single value to display for all fields of this row.Methods inherited from class com.smartgwt.client.data.Record
convertToRecordArray, copyAttributes, copyAttributesInto, getAttributeAsRecordArray, getAttributeAsRecordList, getPaletteDefaults, isARecord, toMap
Methods inherited from class com.smartgwt.client.core.RefDataClass
getRef, getRef, internalSetID
Methods inherited from class com.smartgwt.client.core.DataClass
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
-
Constructor Details
-
ListGridRecord
public ListGridRecord() -
ListGridRecord
-
ListGridRecord
Convenience constructor to build a ListGridRecord from a Record. If the underlying JavaScriptObject is wrapped by a Record, it will be updated to point to the new ListGridRecord.- Parameters:
record
- existing JavaScriptObject wrapper
-
-
Method Details
-
getOrCreateRef
-
set_baseStyle
Name of a CSS style to use as theListGrid.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, usecustomStyle
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()
(orListGrid.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
.- Parameters:
_baseStyle
- New _baseStyle value. Default value is null- Returns:
ListGridRecord
instance, for chaining setter calls- See Also:
-
get_baseStyle
Name of a CSS style to use as theListGrid.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, usecustomStyle
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()
(orListGrid.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
.- Returns:
- Current _baseStyle value. Default value is null
- See Also:
-
set_canEdit
Default property name denoting whether this record can be edited. Property name may be modified for the grid viaListGrid.recordEditProperty
.- Parameters:
_canEdit
- New _canEdit value. Default value is null- Returns:
ListGridRecord
instance, for chaining setter calls- See Also:
-
get_canEdit
Default property name denoting whether this record can be edited. Property name may be modified for the grid viaListGrid.recordEditProperty
.- Returns:
- Current _canEdit value. Default value is null
- See Also:
-
set_canRemove
Default property name denoting whether this record can be removed. Property name may be modified for the grid viaListGrid.recordCanRemoveProperty
.- Parameters:
_canRemove
- New _canRemove value. Default value is null- Returns:
ListGridRecord
instance, for chaining setter calls- See Also:
-
get_canRemove
Default property name denoting whether this record can be removed. Property name may be modified for the grid viaListGrid.recordCanRemoveProperty
.- Returns:
- Current _canRemove value. Default value is null
- See Also:
-
setBackgroundComponent
Has no effect unlessListGrid.showBackgroundComponents
istrue
.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.- Parameters:
backgroundComponent
- New backgroundComponent value. Default value is null- Returns:
ListGridRecord
instance, for chaining setter calls
-
getBackgroundComponent
Has no effect unlessListGrid.showBackgroundComponents
istrue
.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.- Returns:
- Current backgroundComponent value. Default value is null
-
setCanAcceptDrop
When set tofalse
, other records cannot be dropped on (i.e., inserted via drag and drop) immediately before this record.- Parameters:
canAcceptDrop
- New canAcceptDrop value. Default value is null- Returns:
ListGridRecord
instance, for chaining setter calls
-
getCanAcceptDrop
When set tofalse
, other records cannot be dropped on (i.e., inserted via drag and drop) immediately before this record.- Returns:
- Current canAcceptDrop value. Default value is null
-
setCanDrag
When set tofalse
, this record cannot be dragged. If canDrag is false for any record in the current selection, none of the records will be draggable.- Parameters:
canDrag
- New canDrag value. Default value is null- Returns:
ListGridRecord
instance, for chaining setter calls
-
getCanDrag
When set tofalse
, this record cannot be dragged. If canDrag is false for any record in the current selection, none of the records will be draggable.- Returns:
- Current canDrag value. Default value is null
-
setCanExpand
Default property name denoting whether this record can be expanded. Property name may be modified for the grid viaListGrid.canExpandRecordProperty
.- Parameters:
canExpand
- New canExpand value. Default value is null- Returns:
ListGridRecord
instance, for chaining setter calls
-
getCanExpand
Default property name denoting whether this record can be expanded. Property name may be modified for the grid viaListGrid.canExpandRecordProperty
.- Returns:
- Current canExpand value. Default value is null
-
setCanSelect
Default property name denoting whether this record can be selected. Property name may be modified for the grid viaListGrid.recordCanSelectProperty
.- Parameters:
canSelect
- New canSelect value. Default value is null- Returns:
ListGridRecord
instance, for chaining setter calls
-
getCanSelect
Default property name denoting whether this record can be selected. Property name may be modified for the grid viaListGrid.recordCanSelectProperty
.- Returns:
- Current canSelect value. Default value is null
-
setCustomStyle
Name of a CSS style to use for all cells for this particular record.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()
(orListGrid.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
.- Parameters:
customStyle
- New customStyle value. Default value is null- Returns:
ListGridRecord
instance, for chaining setter calls- See Also:
-
getCustomStyle
Name of a CSS style to use for all cells for this particular record.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()
(orListGrid.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
.- Returns:
- Current customStyle value. Default value is null
- See Also:
-
setDetailDS
The default value ofListGrid.recordDetailDSProperty
.Note : This is an advanced setting
- Parameters:
detailDS
- New detailDS value. Default value is null- Returns:
ListGridRecord
instance, for chaining setter calls
-
getDetailDS
The default value ofListGrid.recordDetailDSProperty
.- Returns:
- Current detailDS value. Default value is null
-
setEmbeddedComponent
A component that should be rendered on top of this record, similar to arecord 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 toincremental rendering
, the ListGrid mayCanvas.hide()
orCanvas.clear()
it.If the current dataset is completely replaced (by a call to
ListGrid.setData()
orListGrid.setDataSource()
, for example), any embedded component isdeparented
(which implies beingclear()ed
).When a ListGrid is
destroyed
, it will destroy() all embedded components regardless of whether they are currently visible. Use a call toListGrid.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.- Parameters:
embeddedComponent
- New embeddedComponent value. Default value is null- Returns:
ListGridRecord
instance, for chaining setter calls- See Also:
-
getEmbeddedComponent
A component that should be rendered on top of this record, similar to arecord 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 toincremental rendering
, the ListGrid mayCanvas.hide()
orCanvas.clear()
it.If the current dataset is completely replaced (by a call to
ListGrid.setData()
orListGrid.setDataSource()
, for example), any embedded component isdeparented
(which implies beingclear()ed
).When a ListGrid is
destroyed
, it will destroy() all embedded components regardless of whether they are currently visible. Use a call toListGrid.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.- Returns:
- Current embeddedComponent value. Default value is null
- See Also:
-
setEmbeddedComponentFields
Fields where theembeddedComponent
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.
- Parameters:
embeddedComponentFields
- New embeddedComponentFields value. Default value is null- Returns:
ListGridRecord
instance, for chaining setter calls- See Also:
-
getEmbeddedComponentFields
Fields where theembeddedComponent
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.
- Returns:
- Current embeddedComponentFields value. Default value is null
- See Also:
-
setEmbeddedComponentPosition
Sizing policy applied to the embedded component. Default behavior if unspecified is the same asEmbeddedPosition
"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.- Parameters:
embeddedComponentPosition
- New embeddedComponentPosition value. Default value is null- Returns:
ListGridRecord
instance, for chaining setter calls- See Also:
-
getEmbeddedComponentPosition
Sizing policy applied to the embedded component. Default behavior if unspecified is the same asEmbeddedPosition
"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.- Returns:
- Current embeddedComponentPosition value. Default value is null
- See Also:
-
setEnabled
Default property name denoting whether this record is enabled. Property name may be modified for some grid viaListGrid.recordEnabledProperty
.- Parameters:
enabled
- New enabled value. Default value is null- Returns:
ListGridRecord
instance, for chaining setter calls- See Also:
-
getEnabled
Default property name denoting whether this record is enabled. Property name may be modified for some grid viaListGrid.recordEnabledProperty
.- Returns:
- Current enabled value. Default value is null
- See Also:
-
setIncludeInSummary
If specified as false this record should be ignored when calculating summary totals to be shown in thesummary row
for this grid.Note that
includeInSummary
is the default property name for this attribute, but it may be modified viaListGrid.includeInSummaryProperty
.- Parameters:
includeInSummary
- New includeInSummary value. Default value is null- Returns:
ListGridRecord
instance, for chaining setter calls
-
getIncludeInSummary
If specified as false this record should be ignored when calculating summary totals to be shown in thesummary row
for this grid.Note that
includeInSummary
is the default property name for this attribute, but it may be modified viaListGrid.includeInSummaryProperty
.- Returns:
- Current includeInSummary value. Default value is null
-
setIsGridSummary
This attribute will automatically be set to true for the record representing the grid-level summary row shown ifListGrid.showGridSummary
is true.Note that
isGridSummary
is the default property name for this attribute but it may be modified by settingListGrid.gridSummaryRecordProperty
- Parameters:
isGridSummary
- New isGridSummary value. Default value is false- Returns:
ListGridRecord
instance, for chaining setter calls
-
getIsGridSummary
This attribute will automatically be set to true for the record representing the grid-level summary row shown ifListGrid.showGridSummary
is true.Note that
isGridSummary
is the default property name for this attribute but it may be modified by settingListGrid.gridSummaryRecordProperty
- Returns:
- Current isGridSummary value. Default value is false
-
setIsGroupSummary
This attribute will automatically be set to true for records representing group-level summary rows shown ifListGrid.showGroupSummary
is true.Note that
isGroupSummary
is the default property name for this attribute but it may be modified by settingListGrid.groupSummaryRecordProperty
- Parameters:
isGroupSummary
- New isGroupSummary value. Default value is false- Returns:
ListGridRecord
instance, for chaining setter calls
-
getIsGroupSummary
This attribute will automatically be set to true for records representing group-level summary rows shown ifListGrid.showGroupSummary
is true.Note that
isGroupSummary
is the default property name for this attribute but it may be modified by settingListGrid.groupSummaryRecordProperty
- Returns:
- Current isGroupSummary value. Default value is false
-
setIsSeparator
Default property name denoting a separator row.
When set totrue
, defines a horizontal separator in the listGrid object. Typically this is specified as the only property of a record object, since a record withisSeparator:true
will not display any values.
Note: this attribute name is governed byListGrid.isSeparatorProperty
.- Parameters:
isSeparator
- New isSeparator value. Default value is null- Returns:
ListGridRecord
instance, for chaining setter calls
-
getIsSeparator
Default property name denoting a separator row.
When set totrue
, defines a horizontal separator in the listGrid object. Typically this is specified as the only property of a record object, since a record withisSeparator:true
will not display any values.
Note: this attribute name is governed byListGrid.isSeparatorProperty
.- Returns:
- Current isSeparator value. Default value is null
-
setLinkText
The HTML to display in this row for fields with fieldType set to link. This overridesListGridField.linkText
.- Parameters:
linkText
- New linkText value. Default value is null- Returns:
ListGridRecord
instance, for chaining setter calls- See Also:
-
getLinkText
The HTML to display in this row for fields with fieldType set to link. This overridesListGridField.linkText
.- Returns:
- Current linkText value. Default value is null
- See Also:
-
setShowRollOver
Set to false to disable rollover for this individual record whenListGrid.showRollOver
is true.Note this property can be renamed to prevent collision with data members - see
ListGrid.recordShowRollOverProperty
.- Parameters:
showRollOver
- New showRollOver value. Default value is null- Returns:
ListGridRecord
instance, for chaining setter calls- See Also:
-
getShowRollOver
Set to false to disable rollover for this individual record whenListGrid.showRollOver
is true.Note this property can be renamed to prevent collision with data members - see
ListGrid.recordShowRollOverProperty
.- Returns:
- Current showRollOver value. Default value is null
- See Also:
-
setSingleCellValue
Default property name denoting the single value to display for all fields of this row. If this property is set for some record, the record will be displayed as a single cell spanning every column in the grid, with contents set to the value of this property.
Note: this attribute name is governed byListGrid.singleCellValueProperty
.- Parameters:
singleCellValue
- New singleCellValue value. Default value is null- Returns:
ListGridRecord
instance, for chaining setter calls- See Also:
-
getSingleCellValue
Default property name denoting the single value to display for all fields of this row. If this property is set for some record, the record will be displayed as a single cell spanning every column in the grid, with contents set to the value of this property.
Note: this attribute name is governed byListGrid.singleCellValueProperty
.- Returns:
- Current singleCellValue value. Default value is null
- See Also:
-