com.smartgwt.client.widgets.grid
Class ListGridRecord

java.lang.Object
  extended by com.smartgwt.client.core.JsObject
      extended by com.smartgwt.client.core.DataClass
          extended by com.smartgwt.client.core.RefDataClass
              extended by com.smartgwt.client.data.Record
                  extended by com.smartgwt.client.widgets.grid.ListGridRecord
Direct Known Subclasses:
CellRecord, MenuItem, TreeNode

public class ListGridRecord
extends Record

A ListGridRecord is a JavaScript Object whose properties contain values for each 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.

See Also:
com.smartgwt.client.widgets.grid.ListGrid#getData

Field Summary
 
Fields inherited from class com.smartgwt.client.core.RefDataClass
id
 
Fields inherited from class com.smartgwt.client.core.JsObject
jsObj
 
Constructor Summary
ListGridRecord()
           
ListGridRecord(com.google.gwt.core.client.JavaScriptObject jsObj)
           
 
Method Summary
 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(com.google.gwt.core.client.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.
 
Methods inherited from class com.smartgwt.client.data.Record
convertToRecordArray, copyAttributes, copyAttributesInto, getAttributeAsRecordArray, getAttributeAsRecordList, isARecord, toMap
 
Methods inherited from class com.smartgwt.client.core.RefDataClass
getRef, getRef, internalSetID
 
Methods inherited from class com.smartgwt.client.core.DataClass
doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsDoubleArray, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, 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
 
Methods inherited from class com.smartgwt.client.core.JsObject
equals, getJsObj, hashCode, isCreated, setJavaScriptObject, setJsObj
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListGridRecord

public ListGridRecord()

ListGridRecord

public ListGridRecord(com.google.gwt.core.client.JavaScriptObject jsObj)
Method Detail

getOrCreateRef

public static ListGridRecord getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)

set_baseStyle

public void set_baseStyle(java.lang.String _baseStyle)
Name of a CSS style to use as the 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.

Parameters:
_baseStyle - See CSSStyleName . Default value is null

get_baseStyle

public java.lang.String get_baseStyle()
Name of a CSS style to use as the 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.

Returns:
See CSSStyleName

set_canEdit

public void set_canEdit(java.lang.Boolean _canEdit)
Default property name denoting whether this record can be edited. Property name may be modified for the grid via recordEditProperty.

Parameters:
_canEdit - Default value is null
See Also:
Editing overview and related methods

get_canEdit

public java.lang.Boolean get_canEdit()
Default property name denoting whether this record can be edited. Property name may be modified for the grid via recordEditProperty.

Returns:
Boolean
See Also:
Editing overview and related methods

set_canRemove

public void set_canRemove(java.lang.Boolean _canRemove)
Default property name denoting whether this record can be removed. Property name may be modified for the grid via recordCanRemoveProperty.

Parameters:
_canRemove - Default value is null
See Also:
Editing overview and related methods

get_canRemove

public java.lang.Boolean get_canRemove()
Default property name denoting whether this record can be removed. Property name may be modified for the grid via recordCanRemoveProperty.

Returns:
Boolean
See Also:
Editing overview and related methods

setBackgroundComponent

public void setBackgroundComponent(Canvas backgroundComponent)
Has no effect unless 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.

Parameters:
backgroundComponent - Default value is null

getBackgroundComponent

public Canvas getBackgroundComponent()
Has no effect unless 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.

Returns:
Canvas

setCanAcceptDrop

public 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.

Parameters:
canAcceptDrop - Default value is null

getCanAcceptDrop

public 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.

Returns:
Boolean

setCanDrag

public void setCanDrag(java.lang.Boolean canDrag)
When set to false, 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 - Default value is null

getCanDrag

public java.lang.Boolean getCanDrag()
When set to false, this record cannot be dragged. If canDrag is false for any record in the current selection, none of the records will be draggable.

Returns:
Boolean

setCanExpand

public void setCanExpand(java.lang.Boolean canExpand)
Default property name denoting whether this record can be expanded. Property name may be modified for the grid via canExpandRecordProperty.

Parameters:
canExpand - Default value is null

getCanExpand

public java.lang.Boolean getCanExpand()
Default property name denoting whether this record can be expanded. Property name may be modified for the grid via canExpandRecordProperty.

Returns:
Boolean

setCanSelect

public void setCanSelect(java.lang.Boolean canSelect)
Default property name denoting whether this record can be selected. Property name may be modified for the grid via recordCanSelectProperty.

Parameters:
canSelect - Default value is null

getCanSelect

public java.lang.Boolean getCanSelect()
Default property name denoting whether this record can be selected. Property name may be modified for the grid via recordCanSelectProperty.

Returns:
Boolean

setCustomStyle

public void setCustomStyle(java.lang.String customStyle)
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 (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.

Parameters:
customStyle - See CSSStyleName . Default value is null

getCustomStyle

public java.lang.String 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 (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.

Returns:
See CSSStyleName

setDetailDS

public void setDetailDS(DataSource detailDS)
The default value of recordDetailDSProperty.

Note : This is an advanced setting

Parameters:
detailDS - Default value is null

getDetailDS

public DataSource getDetailDS()
The default value of recordDetailDSProperty.

Returns:
DataSource

setEnabled

public void setEnabled(java.lang.Boolean enabled)
Default property name denoting whether this record is enabled. Property name may be modified for some grid via recordEnabledProperty.

Parameters:
enabled - Default value is null
See Also:
Disabled rows Example

getEnabled

public java.lang.Boolean getEnabled()
Default property name denoting whether this record is enabled. Property name may be modified for some grid via recordEnabledProperty.

Returns:
Boolean
See Also:
Disabled rows Example

setIncludeInSummary

public 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.

Note that includeInSummary is the default property name for this attribute, but it may be modified via includeInSummaryProperty.

Parameters:
includeInSummary - Default value is null

getIncludeInSummary

public 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.

Note that includeInSummary is the default property name for this attribute, but it may be modified via includeInSummaryProperty.

Returns:
Boolean

setIsGridSummary

public 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.

Note that isGridSummary is the default property name for this attribute but it may be modified by setting gridSummaryRecordProperty

Parameters:
isGridSummary - Default value is null

getIsGridSummary

public 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.

Note that isGridSummary is the default property name for this attribute but it may be modified by setting gridSummaryRecordProperty

Returns:
Boolean

setIsGroupSummary

public 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.

Note that isGroupSummary is the default property name for this attribute but it may be modified by setting groupSummaryRecordProperty

Parameters:
isGroupSummary - Default value is null

getIsGroupSummary

public java.lang.Boolean getIsGroupSummary()
This attribute will automatically be set to true for records representing group-level summary rows shown if showGroupSummary is true.

Note that isGroupSummary is the default property name for this attribute but it may be modified by setting groupSummaryRecordProperty

Returns:
Boolean

setIsSeparator

public 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. Typically this is specified as the only property of a record object, since a record with isSeparator:true will not display any values.
Note: this attribute name is governed by isSeparatorProperty.

Parameters:
isSeparator - Default value is null

getIsSeparator

public java.lang.Boolean getIsSeparator()
Default property name denoting a separator row.
When set to 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.
Note: this attribute name is governed by isSeparatorProperty.

Returns:
Boolean

setLinkText

public void setLinkText(java.lang.String linkText)
The HTML to display in this row for fields with fieldType set to link. This overrides linkText.

Parameters:
linkText - Default value is null
See Also:
ListGridFieldType, FieldType, ListGridField.setLinkText(java.lang.String), ListGrid.setLinkTextProperty(java.lang.String)

getLinkText

public java.lang.String getLinkText()
The HTML to display in this row for fields with fieldType set to link. This overrides linkText.

Returns:
String
See Also:
ListGridFieldType, FieldType, ListGridField.getLinkText(), ListGrid.getLinkTextProperty()

setSingleCellValue

public void setSingleCellValue(java.lang.String singleCellValue)
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 by singleCellValueProperty.

Parameters:
singleCellValue - Default value is null

getSingleCellValue

public java.lang.String 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 by singleCellValueProperty.

Returns:
String