Class ListGridRecord

All Implemented Interfaces:
HasHandlers
Direct Known Subclasses:
CellRecord, GroupSummary, MenuItem, TreeNode

public class ListGridRecord extends Record
ListGridRecord represents 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, 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.

  • Constructor Details

    • ListGridRecord

      public ListGridRecord()
    • ListGridRecord

      public ListGridRecord(JavaScriptObject jsObj)
    • ListGridRecord

      public ListGridRecord(Record record)
      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

      public static ListGridRecord getOrCreateRef(JavaScriptObject jsObj)
    • set_baseStyle

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

      Parameters:
      _baseStyle - New _baseStyle value. Default value is null
      Returns:
      ListGridRecord instance, for chaining setter calls
      See Also:
    • get_baseStyle

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

      Returns:
      Current _baseStyle value. Default value is null
      See Also:
    • set_canEdit

      public ListGridRecord set_canEdit(Boolean _canEdit)
      Default property name denoting whether this record can be edited. Property name may be modified for the grid via ListGrid.recordEditProperty.
      Parameters:
      _canEdit - New _canEdit value. Default value is null
      Returns:
      ListGridRecord instance, for chaining setter calls
      See Also:
    • get_canEdit

      public Boolean get_canEdit()
      Default property name denoting whether this record can be edited. Property name may be modified for the grid via ListGrid.recordEditProperty.
      Returns:
      Current _canEdit value. Default value is null
      See Also:
    • set_canRemove

      public ListGridRecord set_canRemove(Boolean _canRemove)
      Default property name denoting whether this record can be removed. Property name may be modified for the grid via ListGrid.recordCanRemoveProperty.
      Parameters:
      _canRemove - New _canRemove value. Default value is null
      Returns:
      ListGridRecord instance, for chaining setter calls
      See Also:
    • get_canRemove

      public Boolean get_canRemove()
      Default property name denoting whether this record can be removed. Property name may be modified for the grid via ListGrid.recordCanRemoveProperty.
      Returns:
      Current _canRemove value. Default value is null
      See Also:
    • setBackgroundComponent

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

      Parameters:
      backgroundComponent - New backgroundComponent value. Default value is null
      Returns:
      ListGridRecord instance, for chaining setter calls
    • getBackgroundComponent

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

      Returns:
      Current backgroundComponent value. Default value is null
    • setCanAcceptDrop

      public ListGridRecord setCanAcceptDrop(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 - New canAcceptDrop value. Default value is null
      Returns:
      ListGridRecord instance, for chaining setter calls
    • getCanAcceptDrop

      public Boolean getCanAcceptDrop()
      When set to false, 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

      public ListGridRecord setCanDrag(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 - New canDrag value. Default value is null
      Returns:
      ListGridRecord instance, for chaining setter calls
    • getCanDrag

      public 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:
      Current canDrag value. Default value is null
    • setCanExpand

      public ListGridRecord setCanExpand(Boolean canExpand)
      Default property name denoting whether this record can be expanded. Property name may be modified for the grid via ListGrid.canExpandRecordProperty.
      Parameters:
      canExpand - New canExpand value. Default value is null
      Returns:
      ListGridRecord instance, for chaining setter calls
    • getCanExpand

      public Boolean getCanExpand()
      Default property name denoting whether this record can be expanded. Property name may be modified for the grid via ListGrid.canExpandRecordProperty.
      Returns:
      Current canExpand value. Default value is null
    • setCanSelect

      public ListGridRecord setCanSelect(Boolean canSelect)
      Default property name denoting whether this record can be selected. Property name may be modified for the grid via ListGrid.recordCanSelectProperty.
      Parameters:
      canSelect - New canSelect value. Default value is null
      Returns:
      ListGridRecord instance, for chaining setter calls
    • getCanSelect

      public Boolean getCanSelect()
      Default property name denoting whether this record can be selected. Property name may be modified for the grid via ListGrid.recordCanSelectProperty.
      Returns:
      Current canSelect value. Default value is null
    • setCustomStyle

      public ListGridRecord setCustomStyle(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 ListGrid.recordCustomStyleProperty.

      Parameters:
      customStyle - New customStyle value. Default value is null
      Returns:
      ListGridRecord instance, for chaining setter calls
      See Also:
    • getCustomStyle

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

      Returns:
      Current customStyle value. Default value is null
      See Also:
    • setDetailDS

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

      Note : This is an advanced setting

      Parameters:
      detailDS - New detailDS value. Default value is null
      Returns:
      ListGridRecord instance, for chaining setter calls
    • getDetailDS

      public DataSource getDetailDS()
      The default value of ListGrid.recordDetailDSProperty.
      Returns:
      Current detailDS value. Default value is null
    • setEmbeddedComponent

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

      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.

      Parameters:
      embeddedComponent - New embeddedComponent value. Default value is null
      Returns:
      ListGridRecord instance, for chaining setter calls
      See Also:
    • getEmbeddedComponent

      public Canvas getEmbeddedComponent()
      A component that should be rendered on top of this record, similar to a 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.

      Returns:
      Current embeddedComponent value. Default value is null
      See Also:
    • setEmbeddedComponentFields

      public ListGridRecord setEmbeddedComponentFields(String... embeddedComponentFields)
      Fields where the 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.

      Parameters:
      embeddedComponentFields - New embeddedComponentFields value. Default value is null
      Returns:
      ListGridRecord instance, for chaining setter calls
      See Also:
    • getEmbeddedComponentFields

      public String[] getEmbeddedComponentFields()
      Fields where the 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.

      Returns:
      Current embeddedComponentFields value. Default value is null
      See Also:
    • setEmbeddedComponentPosition

      public ListGridRecord setEmbeddedComponentPosition(EmbeddedPosition embeddedComponentPosition)
      Sizing policy applied to the embedded component. Default behavior if unspecified is the same as 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.
      Parameters:
      embeddedComponentPosition - New embeddedComponentPosition value. Default value is null
      Returns:
      ListGridRecord instance, for chaining setter calls
      See Also:
    • getEmbeddedComponentPosition

      public EmbeddedPosition getEmbeddedComponentPosition()
      Sizing policy applied to the embedded component. Default behavior if unspecified is the same as 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.
      Returns:
      Current embeddedComponentPosition value. Default value is null
      See Also:
    • setEnabled

      public ListGridRecord setEnabled(Boolean enabled)
      Default property name denoting whether this record is enabled. Property name may be modified for some grid via ListGrid.recordEnabledProperty.
      Parameters:
      enabled - New enabled value. Default value is null
      Returns:
      ListGridRecord instance, for chaining setter calls
      See Also:
    • getEnabled

      public Boolean getEnabled()
      Default property name denoting whether this record is enabled. Property name may be modified for some grid via ListGrid.recordEnabledProperty.
      Returns:
      Current enabled value. Default value is null
      See Also:
    • setIncludeInSummary

      public ListGridRecord setIncludeInSummary(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 ListGrid.includeInSummaryProperty.

      Parameters:
      includeInSummary - New includeInSummary value. Default value is null
      Returns:
      ListGridRecord instance, for chaining setter calls
    • getIncludeInSummary

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

      Returns:
      Current includeInSummary value. Default value is null
    • setIsGridSummary

      public ListGridRecord setIsGridSummary(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.

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

      Parameters:
      isGridSummary - New isGridSummary value. Default value is false
      Returns:
      ListGridRecord instance, for chaining setter calls
    • getIsGridSummary

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

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

      Returns:
      Current isGridSummary value. Default value is false
    • setIsGroupSummary

      public ListGridRecord setIsGroupSummary(Boolean isGroupSummary)
      This attribute will automatically be set to true for records representing group-level summary rows shown if ListGrid.showGroupSummary is true.

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

      Parameters:
      isGroupSummary - New isGroupSummary value. Default value is false
      Returns:
      ListGridRecord instance, for chaining setter calls
    • getIsGroupSummary

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

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

      Returns:
      Current isGroupSummary value. Default value is false
    • setIsSeparator

      public ListGridRecord setIsSeparator(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 ListGrid.isSeparatorProperty.
      Parameters:
      isSeparator - New isSeparator value. Default value is null
      Returns:
      ListGridRecord instance, for chaining setter calls
    • getIsSeparator

      public 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 ListGrid.isSeparatorProperty.
      Returns:
      Current isSeparator value. Default value is null
    • setLinkText

      public ListGridRecord setLinkText(String linkText)
      The HTML to display in this row for fields with fieldType set to link. This overrides ListGridField.linkText.
      Parameters:
      linkText - New linkText value. Default value is null
      Returns:
      ListGridRecord instance, for chaining setter calls
      See Also:
    • getLinkText

      public String getLinkText()
      The HTML to display in this row for fields with fieldType set to link. This overrides ListGridField.linkText.
      Returns:
      Current linkText value. Default value is null
      See Also:
    • setShowRollOver

      public ListGridRecord setShowRollOver(Boolean showRollOver)
      Set to false to disable rollover for this individual record when ListGrid.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

      public Boolean getShowRollOver()
      Set to false to disable rollover for this individual record when ListGrid.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

      public ListGridRecord setSingleCellValue(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 ListGrid.singleCellValueProperty.
      Parameters:
      singleCellValue - New singleCellValue value. Default value is null
      Returns:
      ListGridRecord instance, for chaining setter calls
      See Also:
    • getSingleCellValue

      public 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 ListGrid.singleCellValueProperty.
      Returns:
      Current singleCellValue value. Default value is null
      See Also: