public interface DataBoundComponent extends HasFetchDataHandlers, HasDropCompleteHandlers, HasDragCompleteHandlers
A schema (or DataSource) describes an object as consisting of a set of properties (or "fields").
DataBoundComponents have a dataSource
for dealing with binding to DataSources, fields
the schema information provided by a DataSource, and manipulating objects or sets of object from the DataSource.
The following visual components currently support databinding:
The following non-visual components also support databinding:DynamicForm
DetailViewer
ListGrid
TreeGrid
TileGrid
ColumnTree
CubeGrid
ValuesManager
ResultSet
ResultTree
Modifier and Type | Method and Description |
---|---|
void |
addFormulaField()
Convenience method to display a
com.smartgwt.client..FormulaBuilder to create a new Formula Field. |
void |
addSummaryField()
Convenience method to display a
com.smartgwt.client..SummaryBuilder to create a new Summary Field. |
java.lang.Boolean |
anySelected()
Whether at least one item is selected
|
void |
deselectAllRecords()
Deselect all records
|
void |
deselectRecord(int record)
Deselect a
Record passed in explicitly, or by index. |
void |
deselectRecord(Record record)
Deselect a
Record passed in explicitly, or by index. |
void |
deselectRecords(int[] records)
Deselect a list of
Record s passed in explicitly, or by index. |
void |
deselectRecords(Record[] records)
Deselect a list of
Record s passed in explicitly, or by index. |
void |
disableHilite(java.lang.String hiliteID)
Disable a hilite
|
void |
disableHiliting()
Disable all hilites.
|
void |
editHilites()
Shows a HiliteEditor interface allowing end-users to edit the data-hilites currently in use by this DataBoundComponent.
|
void |
enableHilite(java.lang.String hiliteID)
Enable / disable a
hilites
|
void |
enableHilite(java.lang.String hiliteID,
boolean enable)
Enable / disable a
hilites
|
void |
enableHiliting()
Enable all hilites.
|
void |
enableHiliting(boolean enable)
Enable all hilites.
|
void |
exportData()
Uses a "fetch" operation on the current
DataSource
to retrieve data that matches the current filter and sort criteria for this component, then exports the resulting data
to a file or window in the requested format. |
void |
exportData(DSRequest requestProperties)
Uses a "fetch" operation on the current
DataSource
to retrieve data that matches the current filter and sort criteria for this component, then exports the resulting data
to a file or window in the requested format. |
void |
fetchData()
Retrieves data from the DataSource that matches the specified criteria.
|
void |
fetchData(Criteria criteria)
Retrieves data from the DataSource that matches the specified criteria.
|
void |
fetchData(Criteria criteria,
DSCallback callback)
Retrieves data from the DataSource that matches the specified criteria.
|
void |
fetchData(Criteria criteria,
DSCallback callback,
DSRequest requestProperties)
Retrieves data from the DataSource that matches the specified criteria.
|
void |
filterData()
Retrieves data that matches the provided criteria and displays the matching data in this component.
|
void |
filterData(Criteria criteria)
Retrieves data that matches the provided criteria and displays the matching data in this component.
|
void |
filterData(Criteria criteria,
DSCallback callback)
Retrieves data that matches the provided criteria and displays the matching data in this component.
|
void |
filterData(Criteria criteria,
DSCallback callback,
DSRequest requestProperties)
Retrieves data that matches the provided criteria and displays the matching data in this component.
|
java.lang.Boolean |
getAddDropValues()
Indicates whether to add "drop values" to items dropped on this component, if both the source and target widgets are databound, either to the same DataSource or to
different DataSources that are related via a foreign key.
|
java.lang.String |
getAddFormulaFieldText()
Text for a menu item allowing users to add a formula field
|
java.lang.String |
getAddOperation()
operationId this component
should use when performing add operations. |
java.lang.String |
getAddSummaryFieldText()
Text for a menu item allowing users to add a formula field
|
java.lang.Boolean |
getAutoFetchAsFilter()
If
setAutoFetchData(Boolean) is true, this attribute determines whether the initial fetch operation should be
performed via fetchData() or filterData() |
java.lang.Boolean |
getAutoFetchData()
If true, when this component is first drawn, automatically call
fetchData() or filterData() depending on
getAutoFetchAsFilter() . |
TextMatchStyle |
getAutoFetchTextMatchStyle()
If
autoFetchData is true , this attribute allows the developer to specify a textMatchStyle
for the initial fetchData() call. |
java.lang.Boolean |
getCanAddFormulaFields()
Adds an item to the header context menu allowing users to launch a dialog to define a new
field based on values present in other fields, using the
com.smartgwt.client..FormulaBuilder .
|
java.lang.Boolean |
getCanAddSummaryFields()
Adds an item to the header context menu allowing users to launch a dialog to define a new
text field that can contain both user-defined text and the formatted values present in other
fields, using the
com.smartgwt.client..SummaryBuilder .
|
com.google.gwt.core.client.JavaScriptObject |
getDataAsJSList() |
FetchMode |
getDataFetchMode()
How to fetch and manage records retrieved from the server.
|
int |
getDataPageSize()
When using
data
paging , how many records to fetch at a time. |
DataSource |
getDataSource()
The DataSource that this component should bind to for default fields and for performing
DataSource requests . |
java.lang.Boolean |
getDeepCloneOnEdit()
Before we start editing values in this DataBoundComponent, should we perform a deep clone
of the underlying values.
|
Record[] |
getDragData()
During a drag-and-drop interaction, this method returns the set of records being dragged out of the component.
|
DragDataAction |
getDragDataAction()
Indicates what to do with data dragged into another DataBoundComponent.
|
java.lang.String |
getDragTrackerStyle()
CSS Style to apply to the drag tracker when dragging occurs on this component.
|
java.util.Map |
getDropValues()
When an item is dropped on this component, and
addDropValues is true and both the source and
target widgets are databound, either to the same DataSource or to different DataSources that are related via a foreign key, this object provides the "drop values" that
Smart GWT will apply to the dropped object before updating it. |
java.lang.String |
getDuplicateDragMessage()
Message to show when a user attempts to transfer duplicate records into this component, and
preventDuplicates
is enabled. |
java.lang.String |
getEditFormulaFieldText()
Text for a menu item allowing users to edit a formula field
|
java.lang.String |
getEditSummaryFieldText()
Text for a menu item allowing users to edit the formatter for a field
|
java.lang.Boolean |
getExportAll()
Setting exportAll to true prevents the component from passing its list of fields to the
export call.
|
java.lang.String[] |
getExportFields()
The list of field-names to export.
|
java.lang.Boolean |
getExportIncludeSummaries()
If Summary rows exist for this component, whether to include them when exporting client data.
|
java.lang.String |
getFetchOperation()
Operation ID this component should use when performing fetch operations.
|
Alignment[] |
getFieldAlignments()
Returna an array of field alignments for this grid
|
int |
getFieldCount()
Return the number of fields.
|
com.google.gwt.core.client.JavaScriptObject[] |
getFieldsAsJavaScriptObjects()
Return the fields as JavaScriptObjects rather than as SmartGWT Java wrappers of the field
class type
(e.g.
|
java.lang.String |
getHiliteProperty()
Marker that can be set on a record to flag that record as hilited.
|
Hilite[] |
getHilites()
Return the set of hilite-objects currently applied to this DataBoundComponent.
|
java.lang.String |
getHiliteState()
Get the current hilites encoded as a String, for saving.
|
Criteria |
getImplicitCriteria()
Criteria that are never shown to or edited by the user and are cumulative with any
criteria provided via
DataBoundComponent.initialCriteria ,
DataBoundComponent.setCriteria() etc. |
Criteria |
getInitialCriteria()
Criteria to use when
setAutoFetchData(Boolean) is used. |
com.google.gwt.core.client.JavaScriptObject |
getOrCreateJsObj() |
java.lang.Boolean |
getPreventDuplicates()
If set, detect and prevent duplicate records from being transferred to this component, either via
drag and drop or via
transferSelectedData(com.smartgwt.client.widgets.DataBoundComponent) . |
int |
getRecordIndex(Record record)
Get the index of the provided record.
|
RecordList |
getRecordList()
Return the underlying data of this DataBoundComponent as a
RecordList . |
java.lang.String |
getRemoveOperation()
operationId this component
should use when performing remove operations. |
ResultSet |
getResultSet()
Return the underlying data of this DataBoundComponent as a
ResultSet . |
java.lang.Boolean |
getShowComplexFields()
Whether to show fields of non-atomic types when a DataBoundComponent is given a
DataSource but no
component.fields .
|
java.lang.Boolean |
getShowDetailFields()
Whether to show fields marked
detail:true when a DataBoundComponent is
given a DataSource but no component.fields .
|
java.lang.Boolean |
getShowHiddenFields()
Whether to show fields marked
hidden:true when a DataBoundComponent is given a
DataSource but no component.fields .
|
java.lang.String |
getTitleField()
Method to return the fieldName which represents the "title" for records in this
Component.
If this.titleField is explicitly specified it will always be used. Otherwise, default implementation will check titleField for databound
components.For non databound components returns the first defined field name of "title" ,
"name" , or "id" . |
java.lang.String |
getTitleFieldValue(Record record)
Get the value of the titleField for the passed record
|
java.lang.String |
getUpdateOperation()
operationId this component
should use when performing update operations. |
java.lang.Boolean |
getUseAllDataSourceFields()
If true, the set of fields given by the "default binding" (see
fields ) is used, with any fields specified in
component.fields acting as overrides that can suppress or modify the
display of individual fields, without having to list the entire set of fields that
should be shown.
|
java.lang.Boolean |
getUseFlatFields()
The
useFlatFields flag causes all simple type fields anywhere in a nested
set of DataSources to be exposed as a flat list for form binding. |
void |
invalidateCache()
Invalidate the current data cache for this databound component via a call to the dataset's
invalidateCache() method, for example,
ResultSet.invalidateCache() . |
void |
selectAllRecords()
Select all records
|
void |
selectRecord(int record)
Select/deselect a
Record passed in explicitly, or by index. |
void |
selectRecord(int record,
boolean newState)
Select/deselect a
Record passed in explicitly, or by index. |
void |
selectRecord(Record record)
Select/deselect a
Record passed in explicitly, or by index. |
void |
selectRecord(Record record,
boolean newState)
Select/deselect a
Record passed in explicitly, or by index. |
void |
selectRecords(int[] records)
Select/deselect a list of
Record s passed in explicitly, or by index. |
void |
selectRecords(int[] records,
boolean newState)
Select/deselect a list of
Record s passed in explicitly, or by index. |
void |
selectRecords(Record[] records)
Select/deselect a list of
Record s passed in explicitly, or by index. |
void |
selectRecords(Record[] records,
boolean newState)
Select/deselect a list of
Record s passed in explicitly, or by index. |
void |
setAddDropValues(java.lang.Boolean addDropValues)
Indicates whether to add "drop values" to items dropped on this component, if both the source and target widgets are databound, either to the same DataSource or to
different DataSources that are related via a foreign key.
|
void |
setAddFormulaFieldText(java.lang.String addFormulaFieldText)
Text for a menu item allowing users to add a formula field
|
void |
setAddOperation(java.lang.String addOperation)
operationId this component
should use when performing add operations. |
void |
setAddSummaryFieldText(java.lang.String addSummaryFieldText)
Text for a menu item allowing users to add a formula field
|
void |
setAutoFetchAsFilter(java.lang.Boolean autoFetchAsFilter)
If
setAutoFetchData(Boolean) is true, this attribute determines whether the initial fetch operation should be
performed via fetchData() or filterData() |
void |
setAutoFetchData(java.lang.Boolean autoFetchData)
If true, when this component is first drawn, automatically call
fetchData() or filterData() depending on
getAutoFetchAsFilter() . |
void |
setAutoFetchTextMatchStyle(TextMatchStyle autoFetchAsFilter)
If
autoFetchData is true , this attribute allows the developer to specify a textMatchStyle
for the initial fetchData() call. |
void |
setCanAddFormulaFields(java.lang.Boolean canAddFormulaFields)
Adds an item to the header context menu allowing users to launch a dialog to define a new
field based on values present in other fields, using the
com.smartgwt.client..FormulaBuilder .
|
void |
setCanAddSummaryFields(java.lang.Boolean canAddSummaryFields)
Adds an item to the header context menu allowing users to launch a dialog to define a new
text field that can contain both user-defined text and the formatted values present in other
fields, using the
com.smartgwt.client..SummaryBuilder .
|
void |
setDataFetchMode(FetchMode fetchMode)
How to fetch and manage records retrieved from the server.
|
void |
setDataPageSize(int dataPageSize)
When using
data
paging , how many records to fetch at a time. |
void |
setDataSource(DataSource dataSource)
Bind to a DataSource.
|
void |
setDataSource(java.lang.String dataSource)
Bind to a DataSource.
|
void |
setDeepCloneOnEdit(java.lang.Boolean deepCloneOnEdit)
Before we start editing values in this DataBoundComponent, should we perform a deep clone
of the underlying values.
|
void |
setDragDataAction(DragDataAction dragDataAction)
Indicates what to do with data dragged into another DataBoundComponent.
|
void |
setDragTrackerStyle(java.lang.String dragTrackerStyle)
CSS Style to apply to the drag tracker when dragging occurs on this component.
|
void |
setDropValues(java.util.Map dropValues)
When an item is dropped on this component, and
addDropValues is true and both the source and
target widgets are databound, either to the same DataSource or to different DataSources that are related via a foreign key, this object provides the "drop values" that
Smart GWT will apply to the dropped object before updating it. |
void |
setDuplicateDragMessage(java.lang.String duplicateDragMessage)
Message to show when a user attempts to transfer duplicate records into this component, and
preventDuplicates
is enabled. |
void |
setEditFormulaFieldText(java.lang.String editFormulaFieldText)
Text for a menu item allowing users to edit a formula field
|
void |
setEditSummaryFieldText(java.lang.String editSummaryFieldText)
Text for a menu item allowing users to edit the formatter for a field
|
void |
setExportAll(java.lang.Boolean exportAll)
Setting exportAll to true prevents the component from passing its list of fields to the
export call.
|
void |
setExportFields(java.lang.String[] exportFields)
The list of field-names to export.
|
void |
setExportIncludeSummaries(java.lang.Boolean exportIncludeSummaries)
If Summary rows exist for this component, whether to include them when exporting client data.
|
void |
setFetchOperation(java.lang.String fetchOperation)
Operation ID this component should use when performing fetch operations.
|
void |
setFields(com.google.gwt.core.client.JavaScriptObject... fields)
Field setter variant (alternative to
setFields(FormItem...) ,
setFields(ListGridField...) ,
etc.) that will accept an array of JavaScriptObject, rather than an array of SmartGWT
Java wrappers of the field class type (e.g. |
void |
setHiliteProperty(java.lang.String hiliteProperty)
Marker that can be set on a record to flag that record as hilited.
|
void |
setHilites(Hilite[] hilites)
Accepts an array of hilite objects and applies them to this DataBoundComponent.
|
void |
setHiliteState(java.lang.String hiliteState)
Set the current hilites based on a hiliteState String previously returned from getHilitesState.
|
void |
setImplicitCriteria(Criteria implicitCriteria)
Criteria that are never shown to or edited by the user and are cumulative with any
criteria provided via
DataBoundComponent.initialCriteria ,
DataBoundComponent.setCriteria() etc. |
void |
setInitialCriteria(Criteria initialCriteria)
Criteria to use when
setAutoFetchData(Boolean) is used. |
void |
setPreventDuplicates(java.lang.Boolean preventDuplicates)
If set, detect and prevent duplicate records from being transferred to this component, either via
drag and drop or via
transferSelectedData(com.smartgwt.client.widgets.DataBoundComponent) . |
void |
setRemoveOperation(java.lang.String removeOperation)
operationId this component
should use when performing remove operations. |
void |
setShowComplexFields(java.lang.Boolean showComplexFields)
Whether to show fields of non-atomic types when a DataBoundComponent is given a
DataSource but no
component.fields .
|
void |
setShowDetailFields(java.lang.Boolean showDetailFields)
Whether to show fields marked
detail:true when a DataBoundComponent is
given a DataSource but no component.fields .
|
void |
setShowHiddenFields(java.lang.Boolean showHiddenFields)
Whether to show fields marked
hidden:true when a DataBoundComponent is given a
DataSource but no component.fields .
|
void |
setTitleField(java.lang.String titleField)
Sets the best field to use for a user-visible title for an individual record from this component.
|
void |
setUpdateOperation(java.lang.String updateOperation)
operationId this component
should use when performing update operations. |
void |
setUseAllDataSourceFields(java.lang.Boolean useAllDataSourceFields)
If true, the set of fields given by the "default binding" (see
fields ) is used, with any fields specified in
component.fields acting as overrides that can suppress or modify the
display of individual fields, without having to list the entire set of fields that
should be shown.
|
void |
setUseFlatFields(java.lang.Boolean useFlatFields)
The
useFlatFields flag causes all simple type fields anywhere in a nested
set of DataSources to be exposed as a flat list for form binding. |
void |
transferSelectedData(DataBoundComponent source)
Simulates a drag / drop type transfer of the selected records in some other component to this component, without requiring any user interaction.
|
void |
transferSelectedData(DataBoundComponent source,
int index)
Simulates a drag / drop type transfer of the selected records in some other component to this component, without requiring any user interaction.
|
addFetchDataHandler
addDropCompleteHandler
addDragCompleteHandler
com.google.gwt.core.client.JavaScriptObject getOrCreateJsObj()
void setDataFetchMode(FetchMode fetchMode)
FetchMode
.
This setting only applies to the ResultSet
automatically created by calling fetchData
.
If a pre-existing ResultSet is passed to setData()
instead, its existing setting for fetchMode
applies.
fetchMode
- the fetch modeFetchMode getDataFetchMode()
FetchMode
.
This setting only applies to the ResultSet
automatically created by calling fetchData
.
If a pre-existing ResultSet is passed to setData()
instead, its existing setting for fetchMode
applies.
void setDataPageSize(int dataPageSize)
data
paging
, how many records to fetch at a time. If set to a positive integer,
dataPageSize
will override the default resultSize
for ResultSets
automatically created when you call fetchData()
(and similarly for
the resultSize
of
ResultTrees). The default of 0 means to just use the default page size of the data
container. Note that regardless of the dataPageSize
setting,
a component will always fetch all of data that it needs to draw. Settings such as showAllRecords:true
, drawAllMaxCells
and drawAheadRatio
can cause
more rows than the configured dataPageSize
to be fetched.
dataPageSize
- dataPageSize Default value is 0Databinding overview and related methods
int getDataPageSize()
data
paging
, how many records to fetch at a time. If set to a positive integer,
dataPageSize
will override the default resultSize
for ResultSets
automatically created when you call fetchData()
(and similarly for
the resultSize
of
ResultTrees). The default of 0 means to just use the default page size of the data
container. Note that regardless of the dataPageSize
setting,
a component will always fetch all of data that it needs to draw. Settings such as showAllRecords:true
, drawAllMaxCells
and drawAheadRatio
can cause
more rows than the configured dataPageSize
to be fetched.
Databinding overview and related methods
void setUseAllDataSourceFields(java.lang.Boolean useAllDataSourceFields)
fields
) is used, with any fields specified in
component.fields
acting as overrides that can suppress or modify the
display of individual fields, without having to list the entire set of fields that
should be shown.
If component.fields
contains fields that are not found in the DataSource,
they will be shown after the most recently referred to DataSource field. If the new
fields appear first, they will be shown first.
useAllDataSourceFields
- useAllDataSourceFields Default value is falsejava.lang.Boolean getUseAllDataSourceFields()
fields
) is used, with any fields specified in
component.fields
acting as overrides that can suppress or modify the
display of individual fields, without having to list the entire set of fields that
should be shown.
If component.fields
contains fields that are not found in the DataSource,
they will be shown after the most recently referred to DataSource field. If the new
fields appear first, they will be shown first.
void setShowHiddenFields(java.lang.Boolean showHiddenFields)
hidden:true
when a DataBoundComponent is given a
DataSource but no component.fields
.
The hidden
property is used on DataSource fields to mark fields that are
never of meaning to an end user.
showHiddenFields
- showHiddenFields Default value is falsejava.lang.Boolean getShowHiddenFields()
hidden:true
when a DataBoundComponent is given a
DataSource but no component.fields
.
The hidden
property is used on DataSource fields to mark fields that are
never of meaning to an end user.
void setShowDetailFields(java.lang.Boolean showDetailFields)
detail:true
when a DataBoundComponent is
given a DataSource but no component.fields
.
The detail
property is used on DataSource fields to mark fields that
shouldn't appear by default in a view that tries to show many records in a small space.
showDetailFields
- showDetailFields Default value is falsejava.lang.Boolean getShowDetailFields()
detail:true
when a DataBoundComponent is
given a DataSource but no component.fields
.
The detail
property is used on DataSource fields to mark fields that
shouldn't appear by default in a view that tries to show many records in a small space.
void setShowComplexFields(java.lang.Boolean showComplexFields)
component.fields
.
If true, the component will show fields that declare a complex type, for example, a field 'shippingAddress' that declares type 'Address', where 'Address' is the ID of a DataSource that declares the fields of a shipping address (city, street name, etc).
Such fields may need custom formatters or editors in order to create a usable interface, for example, an Address field in a ListGrid might use a custom formatter to combine the relevant fields of an address into one column, and might use a pop-up dialog for editing.
Note : This is an advanced setting
showComplexFields
- showComplexFields Default value is truejava.lang.Boolean getShowComplexFields()
component.fields
.
If true, the component will show fields that declare a complex type, for example, a field 'shippingAddress' that declares type 'Address', where 'Address' is the ID of a DataSource that declares the fields of a shipping address (city, street name, etc).
Such fields may need custom formatters or editors in order to create a usable interface, for example, an Address field in a ListGrid might use a custom formatter to combine the relevant fields of an address into one column, and might use a pop-up dialog for editing.
void setFetchOperation(java.lang.String fetchOperation)
fetchOperation
- fetchOperation Default value is nulljava.lang.String getFetchOperation()
void setUpdateOperation(java.lang.String updateOperation)
operationId
this component
should use when performing update operations.updateOperation
- Default value is nullOperations overview and related methods
java.lang.String getUpdateOperation()
operationId
this component
should use when performing update operations.Operations overview and related methods
void setAddOperation(java.lang.String addOperation)
operationId
this component
should use when performing add operations.addOperation
- Default value is nullOperations overview and related methods
java.lang.String getAddOperation()
operationId
this component
should use when performing add operations.Operations overview and related methods
void setRemoveOperation(java.lang.String removeOperation)
operationId
this component
should use when performing remove operations.removeOperation
- Default value is nullOperations overview and related methods
java.lang.String getRemoveOperation()
operationId
this component
should use when performing remove operations.Operations overview and related methods
void setExportFields(java.lang.String[] exportFields)
If exportFields is not provided, the exported output includes all visible fields from this component, sorted as they appear.
exportFields
- exportFields Default value is nulljava.lang.String[] getExportFields()
If exportFields is not provided, the exported output includes all visible fields from this component, sorted as they appear.
void setExportAll(java.lang.Boolean exportAll)
fields
.
If exportAll is false, an export operation will first consider
exportFields
, if it's set, and fall back on all visible fields from
fields
otherwise.
exportAll
- exportAll Default value is falsejava.lang.Boolean getExportAll()
fields
.
If exportAll is false, an export operation will first consider
exportFields
, if it's set, and fall back on all visible fields from
fields
otherwise.
void setExportIncludeSummaries(java.lang.Boolean exportIncludeSummaries)
exportIncludeSummaries
- exportIncludeSummaries Default value is truejava.lang.Boolean getExportIncludeSummaries()
void setPreventDuplicates(java.lang.Boolean preventDuplicates) throws java.lang.IllegalStateException
transferSelectedData(com.smartgwt.client.widgets.DataBoundComponent)
.
When a duplicate transfer is detected,
a dialog will appear showing the duplicateDragMessage
.
If the component either does not have a DataSource
or has a DataSource with no
primaryKey
declared, duplicate checking is off by
default. If duplicate checking is enabled, it looks for an existing record in the dataset
that has all of the
properties of the dragged record, and considers that a duplicate.
For DragDataAction
:"copy" where the target DataSource is related to the source
DataSource by foreignKey, a duplicate means that
the target list, as filtered by the current
criteria, already has a record whose value for the foreignKey field matches the
primaryKey of the record being
transferred.
For example, consider dragging "employees" to "teams", where "teams" has a field "teams.employeeId" which is a foreignKey pointing to "employees.id", and the target grid has search criteria causing it to show all the members of one team. A duplicate - adding an employee to the same team twice - is when the target grid's dataset contains an record with "employeeId" matching the "id" field of the dropped employee.
preventDuplicates
- preventDuplicates Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the component has been createdjava.lang.Boolean getPreventDuplicates()
transferSelectedData(com.smartgwt.client.widgets.DataBoundComponent)
.
When a duplicate transfer is detected,
a dialog will appear showing the duplicateDragMessage
.
If the component either does not have a DataSource
or has a DataSource with no
primaryKey
declared, duplicate checking is off by
default. If duplicate checking is enabled, it looks for an existing record in the dataset
that has all of the
properties of the dragged record, and considers that a duplicate.
For DragDataAction
:"copy" where the target DataSource is related to the source
DataSource by foreignKey, a duplicate means that
the target list, as filtered by the current
criteria, already has a record whose value for the foreignKey field matches the
primaryKey of the record being
transferred.
For example, consider dragging "employees" to "teams", where "teams" has a field "teams.employeeId" which is a foreignKey pointing to "employees.id", and the target grid has search criteria causing it to show all the members of one team. A duplicate - adding an employee to the same team twice - is when the target grid's dataset contains an record with "employeeId" matching the "id" field of the dropped employee.
void setDuplicateDragMessage(java.lang.String duplicateDragMessage) throws java.lang.IllegalStateException
preventDuplicates
is enabled. If set to null, duplicates will not be reported and the dragged duplicates will not be saved.duplicateDragMessage
- duplicateDragMessage Default value is "Duplicates not allowed"java.lang.IllegalStateException
- this property cannot be changed after the component has been createdjava.lang.String getDuplicateDragMessage()
preventDuplicates
is enabled. If set to null, duplicates will not be reported and the dragged duplicates will not be saved.void setAddDropValues(java.lang.Boolean addDropValues)
If this value is true and this component is databound, getDropValues()
will be called for every databound item
dropped on this grid, and an update performed on the item
addDropValues
- addDropValues Default value is truejava.lang.Boolean getAddDropValues()
If this value is true and this component is databound, getDropValues()
will be called for every databound item
dropped on this grid, and an update performed on the item
void setDropValues(java.util.Map dropValues)
addDropValues
is true and both the source and
target widgets are databound, either to the same DataSource or to different DataSources that are related via a foreign key, this object provides the "drop values" that
Smart GWT will apply to the dropped object before updating it.If this property is not defined, Smart GWT defaults to returning the selection criteria currently in place for this component. Thus, any databound items (for example, rows from other grids bound to the same DataSource) dropped on the grid will, by default, be subjected to an update that makes them conform to the grid's current filter criteria.
Note : This is an advanced setting
dropValues
- dropValues Default value is nulljava.util.Map getDropValues()
addDropValues
is true and both the source and
target widgets are databound, either to the same DataSource or to different DataSources that are related via a foreign key, this object provides the "drop values" that
Smart GWT will apply to the dropped object before updating it.If this property is not defined, Smart GWT defaults to returning the selection criteria currently in place for this component. Thus, any databound items (for example, rows from other grids bound to the same DataSource) dropped on the grid will, by default, be subjected to an update that makes them conform to the grid's current filter criteria.
Note : This is an advanced setting
dropValues
for more details. If multiple records
are being dropped, this method is called for each of them in turn.
This method returns the following:
addDropValues
is falseYou can override this method if you need more complex setting of drop values than can be provided by simply supplying a dropValues object.
void setUseFlatFields(java.lang.Boolean useFlatFields) throws java.lang.IllegalStateException
useFlatFields
flag causes all simple type fields anywhere in a nested
set of DataSources to be exposed as a flat list for form binding.
useFlatFields
is typically used with imported metadata, such as
XMLTools.loadXMLSchema(java.lang.String, com.smartgwt.client.data.XSDLoadCallback)
from a
XMLTools.loadWSDL(java.lang.String, com.smartgwt.client.data.WSDLLoadCallback)
, as a means of eliminating levels of XML
nesting that aren't meaningful in a user interface, without the cumbersome and fragile
process of mapping form fields to XML structures.
For example, having called WebService.getInputDS(java.lang.String)
to retrieve the input message
schema for a web service operation whose input message looks like this:
<FindServices> <searchFor>search text</searchFor> <Options> <caseSensitive>false</caseSensitive> </Options> <IncludeInSearch> <serviceName>true</serviceName> <documentation>true</documentation> <keywords>true</keywords> </IncludeInSearch> </FindServices>Setting
useFlatFields
on a DynamicForm
that is bound to this input
message schema would result in 5 FormItem
reflecting the 5 simple type
fields in the message.
For this form, the result of DynamicForm.getValues()
might look
like:
{ searchFor: "search text", caseSensitive: false, serviceName: true, documentation : true, keywords : true }When contacting a
WebService
, these values can be automatically
mapped to the structure of the input message for a web service operation by setting
useFlatFields
(for use with WebService.callOperation(java.lang.String, java.util.Map, java.lang.String, com.smartgwt.client.data.WebServiceCallback)
) or by setting
useFlatFields
(for use with a DataSource
that is
'bound to a WSDL web service'
via
wsOperation
).
Using these two facilities in conjunction (component.useFlatFields and request.useFlatFields) allows gratuitous nesting to be consistently bypassed in both the user presentation and when providing the data for XML messages.
You can also set useFlatFields
to automatically enable
"flattened" XML serialization (request.useFlatFields) for all DataSource requests of a
particular operationType.
Note that useFlatFields
is not generally recommended for use with structures
where multiple simple type fields exist with the same name, however if used with such a
structure, the first field to use a given name wins. "first" means the first field
encountered in a depth first search. "wins" means only the first field will be present as a
field when data binding.
useFlatFields
- useFlatFields Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the component has been createdjava.lang.Boolean getUseFlatFields()
useFlatFields
flag causes all simple type fields anywhere in a nested
set of DataSources to be exposed as a flat list for form binding.
useFlatFields
is typically used with imported metadata, such as
XMLTools.loadXMLSchema(java.lang.String, com.smartgwt.client.data.XSDLoadCallback)
from a
XMLTools.loadWSDL(java.lang.String, com.smartgwt.client.data.WSDLLoadCallback)
, as a means of eliminating levels of XML
nesting that aren't meaningful in a user interface, without the cumbersome and fragile
process of mapping form fields to XML structures.
For example, having called WebService.getInputDS(java.lang.String)
to retrieve the input message
schema for a web service operation whose input message looks like this:
<FindServices> <searchFor>search text</searchFor> <Options> <caseSensitive>false</caseSensitive> </Options> <IncludeInSearch> <serviceName>true</serviceName> <documentation>true</documentation> <keywords>true</keywords> </IncludeInSearch> </FindServices>Setting
useFlatFields
on a DynamicForm
that is bound to this input
message schema would result in 5 FormItem
reflecting the 5 simple type
fields in the message.
For this form, the result of DynamicForm.getValues()
might look
like:
{ searchFor: "search text", caseSensitive: false, serviceName: true, documentation : true, keywords : true }When contacting a
WebService
, these values can be automatically
mapped to the structure of the input message for a web service operation by setting
useFlatFields
(for use with WebService.callOperation(java.lang.String, java.util.Map, java.lang.String, com.smartgwt.client.data.WebServiceCallback)
) or by setting
useFlatFields
(for use with a DataSource
that is
'bound to a WSDL web service'
via
wsOperation
).
Using these two facilities in conjunction (component.useFlatFields and request.useFlatFields) allows gratuitous nesting to be consistently bypassed in both the user presentation and when providing the data for XML messages.
You can also set useFlatFields
to automatically enable
"flattened" XML serialization (request.useFlatFields) for all DataSource requests of a
particular operationType.
Note that useFlatFields
is not generally recommended for use with structures
where multiple simple type fields exist with the same name, however if used with such a
structure, the first field to use a given name wins. "first" means the first field
encountered in a depth first search. "wins" means only the first field will be present as a
field when data binding.
void setHiliteProperty(java.lang.String hiliteProperty)
id
for a hilite defined on this component.hiliteProperty
- hiliteProperty Default value is "_hilite"java.lang.String getHiliteProperty()
id
for a hilite defined on this component.void setDragDataAction(DragDataAction dragDataAction)
dragDataAction
- dragDataAction Default value is Canvas.MOVEDragDataAction getDragDataAction()
void setDragTrackerStyle(java.lang.String dragTrackerStyle)
dragTrackerStyle
- dragTrackerStyle Default value is "gridDragTracker"java.lang.String getDragTrackerStyle()
void setCanAddFormulaFields(java.lang.Boolean canAddFormulaFields)
com.smartgwt.client..FormulaBuilder
.
User-added formula fields can be persisted via ListGrid.getFieldState()
and
ListGrid.setFieldState(java.lang.String)
.
canAddFormulaFields
- canAddFormulaFields Default value is falsevoid addSummaryField()
com.smartgwt.client..SummaryBuilder
to create a new Summary Field. This
is equivalent to calling DataBoundComponentGen#editSummaryField
with
no parameter.
void addFormulaField()
com.smartgwt.client..FormulaBuilder
to create a new Formula Field. This
is equivalent to calling DataBoundComponentGen#editFormulaField
with
no parameter.
java.lang.Boolean getCanAddFormulaFields()
com.smartgwt.client..FormulaBuilder
.
User-added formula fields can be persisted via ListGrid.getFieldState()
and
ListGrid.setFieldState(java.lang.String)
.
void setAddFormulaFieldText(java.lang.String addFormulaFieldText)
addFormulaFieldText
- addFormulaFieldText Default value is "Add formula column..."java.lang.String getAddFormulaFieldText()
void setEditFormulaFieldText(java.lang.String editFormulaFieldText)
editFormulaFieldText
- editFormulaFieldText Default value is "Edit formula..."java.lang.String getEditFormulaFieldText()
void setCanAddSummaryFields(java.lang.Boolean canAddSummaryFields)
com.smartgwt.client..SummaryBuilder
.
User-added summary fields can be persisted via ListGrid.getFieldState()
and
ListGrid.setFieldState(java.lang.String)
.
canAddSummaryFields
- canAddSummaryFields Default value is falsejava.lang.Boolean getCanAddSummaryFields()
com.smartgwt.client..SummaryBuilder
.
User-added summary fields can be persisted via ListGrid.getFieldState()
and
ListGrid.setFieldState(java.lang.String)
.
void setAddSummaryFieldText(java.lang.String addSummaryFieldText)
addSummaryFieldText
- addSummaryFieldText Default value is "Add summary column..."java.lang.String getAddSummaryFieldText()
void setEditSummaryFieldText(java.lang.String editSummaryFieldText)
editSummaryFieldText
- editSummaryFieldText Default value is "Edit summary format..."java.lang.String getEditSummaryFieldText()
void selectRecord(Record record)
Record
passed in explicitly, or by index.record
- record (or row number) to selectvoid selectRecord(int record)
Record
passed in explicitly, or by index.record
- record (or row number) to selectvoid selectRecord(int record, boolean newState)
Record
passed in explicitly, or by index.record
- record (or row number) to selectnewState
- new selection state (if null, defaults to true)void selectRecord(Record record, boolean newState)
Record
passed in explicitly, or by index.record
- record (or row number) to selectnewState
- new selection state (if null, defaults to true)void selectRecords(int[] records)
Record
s passed in explicitly, or by index.records
- records (or row numbers) to selectvoid selectRecords(int[] records, boolean newState)
Record
s passed in explicitly, or by index.records
- records (or row numbers) to selectnewState
- new selection statevoid selectRecords(Record[] records)
Record
s passed in explicitly, or by index.records
- records (or row numbers) to selectvoid selectRecords(Record[] records, boolean newState)
Record
s passed in explicitly, or by index.records
- records (or row numbers) to selectnewState
- new selection state (if null, defaults to true)void deselectRecord(Record record)
Record
passed in explicitly, or by index. Synonym for
selectRecord(record, false)
record
- record (or row number) to deselectvoid deselectRecord(int record)
Record
passed in explicitly, or by index. Synonym for
selectRecord(record, false)
record
- record (or row number) to deselectvoid deselectRecords(int[] records)
Record
s passed in explicitly, or by index. Synonym
for selectRecords(records, false)
records
- records (or row numbers) to deselectvoid deselectRecords(Record[] records)
Record
s passed in explicitly, or by index. Synonym
for selectRecords(records, false)
records
- records (or row numbers) to deselectvoid selectAllRecords()
void deselectAllRecords()
java.lang.Boolean anySelected()
void enableHilite(java.lang.String hiliteID)
hilites
hiliteID
- ID of hilite to enablevoid enableHilite(java.lang.String hiliteID, boolean enable)
hilites
hiliteID
- ID of hilite to enableenable
- new enabled state to apply - if null, defaults to truevoid disableHilite(java.lang.String hiliteID)
hiliteID
- ID of hilite to disablevoid enableHiliting()
void enableHiliting(boolean enable)
enable
- new enabled state to apply - if null, defaults to truevoid disableHiliting()
Record[] getDragData()
This method is consulted by
ListGrid.willAcceptDrop()
.
Record
s that are currently selected.void transferSelectedData(DataBoundComponent source)
getDropValues()
for each dropped record.
To transfer all data in, for example, a ListGrid
, call grid.selection.selectAll() first.
Note that drag/drop type transfers of records between components are asynchronous operations: Smart GWT may need to perform server turnarounds to establish whether
dropped records already exist in the target component. Therefore, it is possible to issue a call to transferSelectedData()
and/or the drop()
method of a databound component whilst a transfer is still active. When this happens, Smart GWT adds the second and subsequent transfer requests to a queue and runs
them one after the other. If you want to be notified when a transfer process has actually completed, use addDropCompleteHandler
.
See the Dragging
documentation for an overview of list grid drag/drop data transfer.
source
- source component from which the records will be tranferredvoid transferSelectedData(DataBoundComponent source, int index)
getDropValues()
for each dropped record.
To transfer all data in, for example, a ListGrid
, call grid.selection.selectAll() first.
Note that drag/drop type transfers of records between components are asynchronous operations: Smart GWT may need to perform server turnarounds to establish whether
dropped records already exist in the target component. Therefore, it is possible to issue a call to transferSelectedData()
and/or the drop()
method of a databound component whilst a transfer is still active. When this happens, Smart GWT adds the second and subsequent transfer requests to a queue and runs
them one after the other. If you want to be notified when a transfer process has actually completed, use addDropCompleteHandler
.
See the Dragging
documentation for an overview of list grid drag/drop data transfer.
source
- source component from which the records will be transferredindex
- target index (drop position) of the rows within this grid.int getRecordIndex(Record record)
Override in subclasses to provide more specific behaviour, for instance, when data holds a large number of records
record
- the record whose index is to be retrievedjava.lang.String getTitleFieldValue(Record record)
Override in subclasses
record
- the record whose index is to be retrievedjava.lang.String getTitleField()
titleField
for databound
components."title"
,
"name"
, or "id"
. If we dont find any field-names that match these
titles, the first field in the component will be used instead.
void setTitleField(java.lang.String titleField)
fieldName
- the title field for this component.void setDataSource(DataSource dataSource)
When binding a previously-bound component to a new DataSource, if the component has any existing "fields" or has a dataset, these will be discarded by default, since it is assumed the new DataSource may represent a completely unrelated set of objects. If the old "fields" are still relevant, you may be able to refer to setDataSource(dataSource, fields) as an alternative method if the widget has an implementation of it.
dataSource
- DataSource to bind to. Default value is nullvoid setDataSource(java.lang.String dataSource)
When binding a previously-bound component to a new DataSource, if the component has any existing "fields" or has a dataset, these will be discarded by default, since it is assumed the new DataSource may represent a completely unrelated set of objects. If the old "fields" are still relevant, you may be able to refer to setDataSource(dataSource, fields) as an alternative method if the widget has an implementation of it.
dataSource
- name of DataSource to bind toDataSource getDataSource()
DataSource requests
.void fetchData()
When fetchData()
is first called, if data has not already been provided via
setData()
, this method will create a ResultSet
, which will be
configured based on component settings such as fetchOperation
and dataPageSize
, as well
as the general purpose dataProperties
. The created ResultSet will automatically send a DSRequest
to retrieve data from the dataSource, and from then on will
automatically manage paging through large datasets, as well as performing filtering and
sorting operations inside the browser when possible - see the ResultSet docs for
details.
NOTE: do not use both autoFetchData
and a
call to fetchData()
- this may result in two DSRequests to fetch data. Use
either autoFetchData
and setAutoFetchCriteria()
or a manual call to fetchData()
passing criteria.
Whether a ResultSet was automatically created or provided via setData()
, subsequent
calls to fetchData() will simply call resultSet.setCriteria()
.
Changes to criteria may or may not result in a DSRequest to the server due to
client-side filtering. You can call
willFetchData(criteria)
to determine if new criteria will
result in a server fetch.
If you need to force data to be re-fetched, you can call
invalidateCache()
and new data will
automatically be fetched from the server using the current criteria and sort direction. NOTE:
when using invalidateCache()
there is no need to also call fetchData()
and in fact this could produce unexpected results.
This method takes an optional callback parameter (set to a DSCallback
)
to fire when the fetch completes. Note that this callback will not fire if no server fetch is performed.
In this case the data is updated synchronously, so as soon as this method completes you
can interact with the new data. If necessary, you can use
resultSet.willFetchData()
to determine whether or not a server
fetch will occur when fetchData()
is called with new criteria.
In addition to the callback parameter for this method, developers can use
resultSet.addDataArrivedHandler
to be notified every time data is loaded.
void fetchData(Criteria criteria)
When fetchData()
is first called, if data has not already been provided via
setData()
, this method will create a ResultSet
, which will be
configured based on component settings such as fetchOperation
and dataPageSize
, as well
as the general purpose dataProperties
. The created ResultSet will automatically send a DSRequest
to retrieve data from the dataSource, and from then on will
automatically manage paging through large datasets, as well as performing filtering and
sorting operations inside the browser when possible - see the ResultSet docs for
details.
NOTE: do not use both autoFetchData
and a
call to fetchData()
- this may result in two DSRequests to fetch data. Use
either autoFetchData
and setAutoFetchCriteria()
or a manual call to fetchData()
passing criteria.
Whether a ResultSet was automatically created or provided via setData()
, subsequent
calls to fetchData() will simply call resultSet.setCriteria()
.
Changes to criteria may or may not result in a DSRequest to the server due to
client-side filtering. You can call
willFetchData(criteria)
to determine if new criteria will
result in a server fetch.
If you need to force data to be re-fetched, you can call
invalidateCache()
and new data will
automatically be fetched from the server using the current criteria and sort direction. NOTE:
when using invalidateCache()
there is no need to also call fetchData()
and in fact this could produce unexpected results.
This method takes an optional callback parameter (set to a DSCallback
)
to fire when the fetch completes. Note that this callback will not fire if no server fetch is performed.
In this case the data is updated synchronously, so as soon as this method completes you
can interact with the new data. If necessary, you can use
resultSet.willFetchData()
to determine whether or not a server
fetch will occur when fetchData()
is called with new criteria.
In addition to the callback parameter for this method, developers can use
resultSet.addDataArrivedHandler
to be notified every time data is loaded.
criteria
- Search criteria. If a DynamicForm
is passed in as this argument instead of a raw criteria object, will be
derived by calling DynamicForm.getValuesAsCriteria()
void fetchData(Criteria criteria, DSCallback callback)
When fetchData()
is first called, if data has not already been provided via
setData()
, this method will create a ResultSet
, which will be
configured based on component settings such as fetchOperation
and dataPageSize
, as well
as the general purpose dataProperties
. The created ResultSet will automatically send a DSRequest
to retrieve data from the dataSource, and from then on will
automatically manage paging through large datasets, as well as performing filtering and
sorting operations inside the browser when possible - see the ResultSet docs for
details.
NOTE: do not use both autoFetchData
and a
call to fetchData()
- this may result in two DSRequests to fetch data. Use
either autoFetchData
and setAutoFetchCriteria()
or a manual call to fetchData()
passing criteria.
Whether a ResultSet was automatically created or provided via setData()
, subsequent
calls to fetchData() will simply call resultSet.setCriteria()
.
Changes to criteria may or may not result in a DSRequest to the server due to
client-side filtering. You can call
willFetchData(criteria)
to determine if new criteria will
result in a server fetch.
If you need to force data to be re-fetched, you can call
invalidateCache()
and new data will
automatically be fetched from the server using the current criteria and sort direction. NOTE:
when using invalidateCache()
there is no need to also call fetchData()
and in fact this could produce unexpected results.
This method takes an optional callback parameter (set to a DSCallback
)
to fire when the fetch completes. Note that this callback will not fire if no server fetch is performed.
In this case the data is updated synchronously, so as soon as this method completes you
can interact with the new data. If necessary, you can use
resultSet.willFetchData()
to determine whether or not a server
fetch will occur when fetchData()
is called with new criteria.
In addition to the callback parameter for this method, developers can use
resultSet.addDataArrivedHandler
to be notified every time data is loaded.
criteria
- Search criteria. If a DynamicForm
is passed in as this argument instead of a raw criteria object, will be
derived by calling DynamicForm.getValuesAsCriteria()
callback
- callback to invoke when a fetch is complete. Fires only
if server contact was requiredvoid fetchData(Criteria criteria, DSCallback callback, DSRequest requestProperties)
When fetchData()
is first called, if data has not already been provided via
setData()
, this method will create a ResultSet
, which will be
configured based on component settings such as fetchOperation
and dataPageSize
, as well
as the general purpose dataProperties
. The created ResultSet will automatically send a DSRequest
to retrieve data from the dataSource, and from then on will
automatically manage paging through large datasets, as well as performing filtering and
sorting operations inside the browser when possible - see the ResultSet docs for
details.
NOTE: do not use both autoFetchData
and a
call to fetchData()
- this may result in two DSRequests to fetch data. Use
either autoFetchData
and setAutoFetchCriteria()
or a manual call to fetchData()
passing criteria.
Whether a ResultSet was automatically created or provided via setData()
, subsequent
calls to fetchData() will simply call resultSet.setCriteria()
.
Changes to criteria may or may not result in a DSRequest to the server due to
client-side filtering. You can call
willFetchData(criteria)
to determine if new criteria will
result in a server fetch.
If you need to force data to be re-fetched, you can call
invalidateCache()
and new data will
automatically be fetched from the server using the current criteria and sort direction. NOTE:
when using invalidateCache()
there is no need to also call fetchData()
and in fact this could produce unexpected results.
This method takes an optional callback parameter (set to a DSCallback
)
to fire when the fetch completes. Note that this callback will not fire if no server fetch is performed.
In this case the data is updated synchronously, so as soon as this method completes you
can interact with the new data. If necessary, you can use
resultSet.willFetchData()
to determine whether or not a server
fetch will occur when fetchData()
is called with new criteria.
In addition to the callback parameter for this method, developers can use
resultSet.addDataArrivedHandler
to be notified every time data is loaded.
criteria
- Search criteria. If a DynamicForm
is passed in as this argument instead of a raw criteria object,
will be derived by calling DynamicForm.getValuesAsCriteria()
callback
- callback to invoke when a fetch is complete. Fires
only if server contact was requiredrequestProperties
- additional properties to set on the DSRequest
that will be issuedvoid filterData()
This
method behaves exactly like ListGrid.fetchData()
except that textMatchStyle
is automatically set to "substring" so that
String-valued fields are matched by case-insensitive substring comparison.
criteria
- Search criteria. If a DynamicForm
is passed in as this argument instead of a raw criteria object, will be
derived by calling DynamicForm.getValuesAsCriteria()
void filterData(Criteria criteria)
This
method behaves exactly like ListGrid.fetchData()
except that textMatchStyle
is automatically set to "substring" so that
String-valued fields are matched by case-insensitive substring comparison.
criteria
- Search criteria. If a DynamicForm
is passed in as this argument instead of a raw criteria object, will be
derived by calling DynamicForm.getValuesAsCriteria()
callback
- callback to invoke when a fetch is complete. Fires only
if server contact was required; see fetchData()
for detailsvoid filterData(Criteria criteria, DSCallback callback)
This
method behaves exactly like ListGrid.fetchData()
except that textMatchStyle
is automatically set to "substring" so that
String-valued fields are matched by case-insensitive substring comparison.
criteria
- Search criteria. If a DynamicForm
is passed in as this argument instead of a raw criteria object,
will be derived by calling DynamicForm.getValuesAsCriteria()
callback
- callback to invoke when a fetch is complete. Fires
only if server contact was required; see
fetchData()
for detailsvoid filterData(Criteria criteria, DSCallback callback, DSRequest requestProperties)
This
method behaves exactly like ListGrid.fetchData()
except that textMatchStyle
is automatically set to "substring" so that
String-valued fields are matched by case-insensitive substring comparison.
criteria
- Search criteria. If a DynamicForm
is passed in as this argument instead of a raw criteria object,
will be derived by calling DynamicForm.getValuesAsCriteria()
callback
- callback to invoke when a fetch is complete. Fires
only if server contact was required; see
fetchData()
for detailsrequestProperties
- for databound components only - optional additional
properties to set on the DSRequest that will be issuedvoid setAutoFetchData(java.lang.Boolean autoFetchData)
fetchData()
or filterData()
depending on
getAutoFetchAsFilter()
. Criteria for this fetch may be picked up from initialCriteria
and textMatchStyle may be specified via getAutoFetchTextMatchStyle()
.
NOTE: If autoFetchData is set, calling ListGrid.fetchData() before draw will cause two requests to be
issued, one from the manual call to fetchData() and one from the autoFetchData setting. The second request will use only
initialCriteria
and not any other criteria or settings from the first request. Generally, turn off
autoFetchData if you are going to manually call fetchData() at any time.
autoFetchData
- autoFetchDatajava.lang.Boolean getAutoFetchData()
fetchData()
or filterData()
depending on
getAutoFetchAsFilter()
. Criteria for this fetch may be picked up from initialCriteria
and textMatchStyle may be specified via getAutoFetchTextMatchStyle()
.
NOTE: If autoFetchData is set, calling ListGrid.fetchData() before draw will cause two requests to be
issued, one from the manual call to fetchData() and one from the autoFetchData setting. The second request will use only
initialCriteria
and not any other criteria or settings from the first request. Generally, turn off
autoFetchData if you are going to manually call fetchData() at any time.
void setAutoFetchAsFilter(java.lang.Boolean autoFetchAsFilter)
setAutoFetchData(Boolean)
is true, this attribute determines whether the initial fetch operation should be
performed via fetchData()
or filterData()
autoFetchAsFilter
- autoFetchAsFilterjava.lang.Boolean getAutoFetchAsFilter()
setAutoFetchData(Boolean)
is true, this attribute determines whether the initial fetch operation should be
performed via fetchData()
or filterData()
void setAutoFetchTextMatchStyle(TextMatchStyle autoFetchAsFilter)
autoFetchData
is true
, this attribute allows the developer to specify a textMatchStyle
for the initial fetchData()
call.autoFetchTextMatchStyle
- autoFetchTextMatchStyleTextMatchStyle getAutoFetchTextMatchStyle()
autoFetchData
is true
, this attribute allows the developer to specify a textMatchStyle
for the initial fetchData()
call.void setInitialCriteria(Criteria initialCriteria) throws java.lang.IllegalStateException
setAutoFetchData(Boolean)
is used.initialCriteria
- the initial criteriajava.lang.IllegalStateException
- this property cannot be changed after the component has been createdCriteria getInitialCriteria()
setAutoFetchData(Boolean)
is used.void setImplicitCriteria(Criteria implicitCriteria)
DataBoundComponent.initialCriteria
,
DataBoundComponent.setCriteria()
etc.implicitCriteria
- New implicitCriteria value. Default value is nullCriteria getImplicitCriteria()
DataBoundComponent.initialCriteria
,
DataBoundComponent.setCriteria()
etc.void invalidateCache()
invalidateCache()
method, for example,
ResultSet.invalidateCache()
.
NOTE: there is no need to call invalidateCache()
when a save operation
is performed on a DataSource. Automatic cache synchronization features will automatically
update caches - see ResultSet
for details. If automatic
cache synchronization isn't working, troubleshoot the problem using the steps suggested
in the FAQ rather than just calling invalidateCache(). Calling
invalidateCache()
unnecessarily causes extra server load and added code
complexity.
Calling invalidateCache()
will automatically cause a new
fetch to be performed with the current set of criteria if data had been previously
fetched and the component is currently drawn with data visible - there is no need to
manually call fetchData() after invalidateCache() and this could result in duplicate
fetches.
While data is being re-loaded after a call to invalidateCache()
, the widget
is in a state similar to initial data load - it doesn't know the total length of the
dataset and any APIs that act on records or row indices will necessarily fail and should
not be called. To detect that the widget is in this state, call
ResultSet.lengthIsKnown()
.
invalidateCache()
only has an effect if this component's dataset is a data
manager class that manages a cache (eg ResultSet or ResultTree). If data was provided as
a simple Array or List, invalidateCache() does nothing.
ResultSet getResultSet()
ResultSet
.
Note that this method should only be called after initial data has been fetched by this DataBoundComponent.
fetchData()
RecordList getRecordList()
RecordList
.
Depending on the component configuration, the actual JavaScript instance of the returned RecordList may be one of several types:
DataSource
,
the instance is generally an Array of Record
.ResultSet
.Tree
.
To access the ungrouped record list regardless of grouping status, use
isGrouped() ? getOriginalRecordList() : getRecordList()
TreeGrid
,
the instance is a ResultTree.com.google.gwt.core.client.JavaScriptObject getDataAsJSList()
void exportData()
DataSource
to retrieve data that matches the current filter and sort criteria for this component, then exports the resulting data
to a file or window in the requested format. A variety of DSRequest settings, such as exportAs
and exportFilename
, affect the exporting process: see exportResults
for further detail.
Note that data exported via this method does not include any client-side
formatting and relies on both the Smart GWT server and server-side DataSources. To export client-data with formatters
applied, see exportClientData
, which still
requires the Smart GWT server but does not rely on server-side DataSources.
For more information on exporting data,
see DataSource.exportData
.
void exportData(DSRequest requestProperties)
DataSource
to retrieve data that matches the current filter and sort criteria for this component, then exports the resulting data
to a file or window in the requested format. A variety of DSRequest settings, such as exportAs
and exportFilename
, affect the exporting process: see exportResults
for further detail.
Note that data exported via this method does not include any client-side
formatting and relies on both the Smart GWT server and server-side DataSources. To export client-data with formatters
applied, see exportClientData
, which still
requires the Smart GWT server but does not rely on server-side DataSources.
For more information on exporting data,
see DataSource.exportData
.
requestProperties
- additional properties to set on the DSRequest that will be issuedDataBoundComponentMethods overview and related methods
void editHilites()
java.lang.String getHiliteState()
void setHiliteState(java.lang.String hiliteState)
hiliteState
- hilites state encoded as a Stringvoid setHilites(Hilite[] hilites)
getHilites
for a method of
retrieving the hilite array for storage, including hilites manually added by the user.hilites
- array of hilite objectsHilite[] getHilites()
Alignment[] getFieldAlignments()
java.lang.Boolean getDeepCloneOnEdit()
DataSource.getDeepCloneOnEdit()
for details of what this means.
If this value is not explicitly set, it defaults to the DataSource deepCloneOnEdit
value.
This value can also be overridden per-field with DataSourceField.setDeepCloneOnEdit(java.lang.Boolean)
.
Like the other deepCloneOnEdit
settings, this flag only has an effect if you are
editing a values object that contains nested objects or arrays, using Canvas.setDataPath(java.lang.String)
void setDeepCloneOnEdit(java.lang.Boolean deepCloneOnEdit)
DataSource.getDeepCloneOnEdit()
for details of what this means.
If this value is not explicitly set, it defaults to the DataSource deepCloneOnEdit
value.
This value can also be overridden per-field with DataSourceField.setDeepCloneOnEdit(java.lang.Boolean)
.
Like the other deepCloneOnEdit
settings, this flag only has an effect if you are
editing a values object that contains nested objects or arrays, using Canvas.setDataPath(java.lang.String)
void setFields(com.google.gwt.core.client.JavaScriptObject... fields)
setFields(FormItem...)
,
setFields(ListGridField...)
,
etc.) that will accept an array of JavaScriptObject, rather than an array of SmartGWT
Java wrappers of the field class type (e.g.
FormItem
,
ListGridField
, etc.)
This is an advanced method and only for cases where you have the JavaScriptObject for
each field but want to avoid having to create each associated SmartGWT Java wrapper.
Note: use toArray()
to create a Java
array of JavaScriptObject if you only have the array itself as a single JavaScriptObject.
fields
- the component fieldscom.google.gwt.core.client.JavaScriptObject[] getFieldsAsJavaScriptObjects()
FormItem
,
ListGridField
, etc.)
This avoids building the SmartGWT Java wrappers for the fields in situations where they
aren't needed - and for FormItems in particular - where there may not be enough
information to determine the correct subclass, such as before the SmartClient instance
underlying the DynamicForm
has been
created.int getFieldCount()