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:
MenuItem, TreeNode

public class ListGridRecord
extends Record

A ListGridRecord is a JavaScript Object whose properties contain values for each ${isc.DocUtils.linkForRef('object: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 ListGrid.addCellClickHandler(com.smartgwt.client.widgets.grid.events.CellClickHandler).

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(int, int) 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.JsObject
jsObj
 
Constructor Summary
ListGridRecord()
           
ListGridRecord(com.google.gwt.core.client.JavaScriptObject jsObj)
           
 
Method Summary
 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 getEnabled()
          Default property name denoting whether this record is enabled.
 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. 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.
 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 setEnabled(java.lang.Boolean enabled)
          Default property name denoting whether this record is enabled.
 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. 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.
 
Methods inherited from class com.smartgwt.client.data.Record
convertToRecordArray
 
Methods inherited from class com.smartgwt.client.core.RefDataClass
getRef, getRef
 
Methods inherited from class com.smartgwt.client.core.DataClass
doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsObject, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, getJsObj, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute
 
Methods inherited from class com.smartgwt.client.core.JsObject
isCreated, setJsObj
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, 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)

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 - enabled Default value is null

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

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

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

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

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

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 - linkText Default value is null

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