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
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(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
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
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
recordDetailDSProperty . |
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
showGridSummary is true. |
java.lang.Boolean |
getIsGroupSummary()
This attribute will automatically be set to true for records representing group-level summary rows shown if
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(JavaScriptObject jsObj) |
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
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
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
recordDetailDSProperty . |
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
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
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 |
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, 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(JavaScriptObject jsObj)
public ListGridRecord(Record record)
record
- existing JavaScriptObject wrapperpublic static ListGridRecord getOrCreateRef(JavaScriptObject jsObj)
public void set_baseStyle(java.lang.String _baseStyle)
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
recordBaseStyleProperty
.
_baseStyle
- See CSSStyleName
. Default value is nullpublic java.lang.String get_baseStyle()
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
recordBaseStyleProperty
.
CSSStyleName
public void set_canEdit(java.lang.Boolean _canEdit)
recordEditProperty
._canEdit
- Default value is nullEditing overview and related methods
public java.lang.Boolean get_canEdit()
recordEditProperty
.Editing overview and related methods
public void set_canRemove(java.lang.Boolean _canRemove)
recordCanRemoveProperty
._canRemove
- Default value is nullEditing overview and related methods
public java.lang.Boolean get_canRemove()
recordCanRemoveProperty
.Editing overview and related methods
public void setBackgroundComponent(Canvas backgroundComponent)
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 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
- Default value is nullpublic Canvas getBackgroundComponent()
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 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
- 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
- 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)
canExpandRecordProperty
.canExpand
- Default value is nullpublic java.lang.Boolean getCanExpand()
canExpandRecordProperty
.public void setCanSelect(java.lang.Boolean canSelect)
recordCanSelectProperty
.canSelect
- Default value is nullpublic java.lang.Boolean getCanSelect()
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
recordCustomStyleProperty
.
customStyle
- See CSSStyleName
. Default value is nullpublic 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
recordCustomStyleProperty
.
CSSStyleName
public void setDetailDS(DataSource detailDS)
recordDetailDSProperty
.
Note : This is an advanced setting
detailDS
- Default value is nullpublic DataSource getDetailDS()
recordDetailDSProperty
.public void setEnabled(java.lang.Boolean enabled)
recordEnabledProperty
.enabled
- Default value is nullpublic java.lang.Boolean getEnabled()
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 includeInSummaryProperty
.
includeInSummary
- 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 includeInSummaryProperty
.
public void setIsGridSummary(java.lang.Boolean isGridSummary)
showGridSummary
is true. Note that
isGridSummary
is the default property name for this attribute but it may be modified by setting gridSummaryRecordProperty
isGridSummary
- Default value is nullpublic java.lang.Boolean getIsGridSummary()
showGridSummary
is true. Note that
isGridSummary
is the default property name for this attribute but it may be modified by setting gridSummaryRecordProperty
public void setIsGroupSummary(java.lang.Boolean isGroupSummary)
showGroupSummary
is true. Note that
isGroupSummary
is the default property name for this attribute but it may be modified by setting groupSummaryRecordProperty
isGroupSummary
- Default value is nullpublic java.lang.Boolean getIsGroupSummary()
showGroupSummary
is true. Note that
isGroupSummary
is the default property name for this attribute but it may be modified by setting 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.isSeparatorProperty
.isSeparator
- 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.isSeparatorProperty
.public void setLinkText(java.lang.String linkText)
linkText
.linkText
- Default value is nullListGridFieldType
,
FieldType
,
ListGridField.setLinkText(java.lang.String)
,
ListGrid.setLinkTextProperty(java.lang.String)
public java.lang.String getLinkText()
linkText
.ListGridFieldType
,
FieldType
,
ListGridField.getLinkText()
,
ListGrid.getLinkTextProperty()
public void setSingleCellValue(java.lang.String singleCellValue)
singleCellValueProperty
.singleCellValue
- Default value is nullpublic java.lang.String getSingleCellValue()
singleCellValueProperty
.