Class ResultSet
- All Implemented Interfaces:
HasHandlers
,HasDataArrivedHandlers
,HasDataChangedHandlers
- Direct Known Subclasses:
FilteredList
com.smartgwt.client.data.List
interface that automatically fetches
DataSource records when items are requested from the List. ResultSets provide robust,
customizable, high-performance cache management for ListGrids and other built-in Smart GWT
components, and can be used as cache managers by custom components.
ResultSets manage data paging, that is, loading records in batches as the user navigates the data set. A ResultSet will switch to using client-side sorting and filtering when possible to improve responsiveness and reduce server load. ResultSets also participate in automatic cache synchronization, observing operations on DataSources and automatically updating their caches.
Creation
A ResultSet can be passed to any component that expects a List, and the List APIs can be
called directly on the ResultSet as long as the caller is able to deal with asynchronous
loading; see getRange()
.
Generally ResultSets do not need to be created directly, but are created by DataBound
components as an automatic consequence of calling
DataBound Component Methods
.
For example, the ListGrid.fetchData()
causes ListGrid.data
to become an
automatically created ResultSet
object. Automatically created ResultSets
can be customized via properties on ListGrids such as ListGrid.dataPageSize
and
ListGrid.dataProperties
. All ResultSets for a given
DataSource may also be
customized via setting DataSource.resultSetClass
to the
name of a ResultSet
subclass
in which
defaults have been changed.
A ResultSet defaults to using data paging, setting DSRequest.startRow
and
DSRequest.endRow
in issued dsRequests. Server code may always
return more rows than
the ResultSet requests and the ResultSet will correctly integrate those rows based on
DSResponse.startRow
/endRow
.
Hence the server can always avoid paging mode by simply returning all matching rows.
A ResultSet can be created directly with just the ID of a DataSource
:
ResultSet resultSet = new ResultSet(); resultSet.setDataSource(dataSourceID);
Directly created ResultSets are typically used by custom components, or as a means of managing datasets that will be used by several components.
When created directly rather than via a dataBoundComponent, a newly created ResultSet will
not issue it's first "fetch" DSRequest
until data is accessed (for example, via
get()
).
Paging and total dataset length
When using data paging, the server communicates the total number of records that match the
current search criteria by setting DSResponse.totalRows
. The
ResultSet will then
return this number from getLength()
, and ListGrids and other
components will show a scrollbar that allows the user to jump to the end of the dataset
directly.
However, the ResultSet does not require that the server calculate the true length of the
dataset, which can be costly for an extremely large, searchable dataset. Instead, the
server may advertise a totalRows
value that is one page larger
than the last row loaded. This results in a UI sometimes called "progressive loading",
where the user may load more rows by scrolling past the end of the currently loaded rows,
but is not allowed to skip to the end of the dataset.
The Smart GWT server offers built in support for progressive loading at the
dataSource
,
operationBinding
and
request
level for SQL-backed dataSources.
Setting progressiveLoading
or DataBoundComponent.progressiveLoading
to
true will also enable this feature where available.
Where available, progressive loading will also be enabled automatically
for very large data sets if a
DataSource.progressiveLoadingThreshold
is specified.
Note that the Smart GWT server is not a requirement for progressive loading -
any DataSource implementation can enable progressive loading by simply populating
the DSResponse.totalRows
property with an appropriate value.
We recommend the DSResponse.progressiveLoading
attribute be set to true
as well - this allows client side logic to treat the reported totalRows
value specially if necessary.
No client-side settings are required to enable this mode - it is entirely server-driven.
However, it is usually coupled with disabling sorting
,
since
server-side sorting would also force the server to traverse the entire dataset.
Client-side Sorting and Filtering
If a ResultSet obtains a full cache for the current set of filter criteria, it will automatically switch to client-side sorting, and will also use client-side filtering if the filter criteria are later changed but appear to be more restrictive than the criteria in use when the ResultSet obtained a full cache.
The useClientSorting
and
useClientFiltering
flags can be used to disable
client-side sorting and filtering respectively if these behaviors don't match server-based
sorting and filtering. However, because client-side sorting and filtering radically improve
responsiveness and reduce server load, it is better to customize the ResultSet so that it
can match server-side sorting and filtering behaviors.
Sorting behavior is primarily customized via the "sort normalizer" passed to
sortByProperty()
, either via direct calls on a standalone
ResultSet, or via
ListGridField.sortNormalizer()
for a
ListGrid-managed ResultSet.
By default, client-side filtering interprets the criteria
passed to
setCriteria()
as a set of field values that records must match
(similarly to the built-in SQL/Hibernate connectors built into the Smart GWT Server).
Custom client-side filtering logic can be implemented by overriding
applyFilter()
. Overriding
compareCriteria()
allows you to control when the ResultSet
uses client-side vs server-side filtering, and the ResultSet has two default
criteria policies
built-in.
Modifying ResultSets
Records cannot be directly added or removed from a ResultSet via com.smartgwt.client.data.List
APIs such as removeAt()
, unless it always filters locally, since
this would break the consistency of server and client row numbering needed for data paging,
and also create some issues with automatic cache synchronization. Set
modifiable
to enable the com.smartgwt.client.data.List
modification APIs on a
fetchMode
:"local" ResultSet. Note that the special
FilteredList
class sets this property to allow developers to modify its data.
Use DataSource.addData()
/removeData()
to add/remove
rows from the DataSource
, and the ResultSet will reflect the changes automatically.
Alternatively, the DataSource.updateCaches()
method may be
called to only update
local caches of the DataSource in question, without generating any server traffic.
To create a locally modifiable cache of Records from a DataSource, you
can use DataSource.fetchData()
to retrieve a List of Records which
can
be modified directly, or you can create a client-only DataSource
from
the retrieved data to share a modifiable cache between several
DataBoundComponents.
Updates and Automatic Cache Synchronization
Once a ResultSet has retrieved data or has been initialized with data, the ResultSet will observe any successful "update", "add" or "remove" dsRequests against their DataSource, regardless of the component that initiated them. A ResultSet with a full cache for the current filter criteria will integrate updates into the cache automatically.
Updated rows that no longer match the current filter criteria will be removed
automatically. To prevent this, you can set neverDropUpdatedRows
.
Added rows will similarly be added to the cache only if they match current filter criteria.
Note that the client-side filtering described above is also used to determine whether
updated or added rows should be in the cache. If any aspect of automated cache update is
ever incorrect, dropCacheOnUpdate
can be set for the
ResultSet or DSResponse.invalidateCache
can be set for an
individual dsResponse.
If automatic cache synchronization isn't working, troubleshoot the problem using the steps suggested in the FAQ.
Regarding operationIds
and how they affect caching,
take into account that cache sync is based on the fetch used - any add or update operation
uses a fetch to retrieve updated data, and the operationId of that fetch can be set via
cacheSyncOperation
.
If the operationId of the cache is different from the operationId of the cache update data,
it won't be used to update the cache, since the fields included and other aspects of the
data are allowed to be different across different operationIds. This allows to maintain
distinct caches on a per component basis, so when two components are using separate
operationIds they are assumed to have distinct caches, because updates performed with
one operationId will not affect the cache obtained via another operationId.
Also, take into account that operationId must be unique per DataSource, across all
operationTypes for that DataSource.
Data Paging with partial cache
When in paging mode with a partial cache, a ResultSet relies on server side sorting, setting
DSRequest.sortBy
to the current sort field and direction. In order
for the cache to
remain coherent, row numbering must continue to agree between server and client as new
fetches are issued, otherwise, duplicate rows or missing rows may occur.
If concurrent modifications by other users are allowed, generally the server should set
DSResponse.invalidateCache
to clear the cache when
concurrent modification is
detected.
In paging mode with a partial cache, any successful "update" or "add" operation may cause client and server row numbering to become out of sync. This happens because the update may affect the sort order, and client and server cannot be guaranteed to match for sets of records that have equivalent values for the sort field.
For this reason, after an "add" or "update" operation with a partial cache, the ResultSet
will automatically mark cache for invalidation the next time a fetch operation is performed.
Alternatively, if updatePartialCache
is set to false,
the ResultSet will
simply invalidate cache immediately in this circumstance.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.smartgwt.client.data.RecordList
RecordList.SortNormalizer
-
Field Summary
Fields inherited from class com.smartgwt.client.data.RecordList
jsObj
Fields inherited from class com.smartgwt.client.core.BaseClass
config, configOnly, factoryCreated, factoryProperties, id, scClassName
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddDataArrivedHandler
(DataArrivedHandler handler) Add a dataArrived handler.boolean
Do we have a complete client-side cache of records for the current filter criteria?boolean
Do we have a complete client-side cache of all records for this DataSource?String[]
applyFilter
(String[] data, Criteria criteria) The ResultSet will call applyFilter() when it needs to determine whether rows match the current filter criteria.String[]
applyFilter
(String[] data, Criteria criteria, DSRequest requestProperties) The ResultSet will call applyFilter() when it needs to determine whether rows match the current filter criteria.static ResultSet
asSGWTComponent
(JavaScriptObject jsObj) Returns the existing SGWT ResultSet, or creates and returns one if none exist, associated with the suppliedJavaScriptObject
.int
compareCriteria
(Criteria newCriteria, Criteria oldCriteria) Default behavior is to callDataSource.compareCriteria()
to determine whether new criteria is guaranteed more restrictive, equivalent to the old criteria, or not guaranteed more restrictive, returning 1, 0 or -1 respectively.int
compareCriteria
(Criteria newCriteria, Criteria oldCriteria, DSRequest requestProperties) int
compareCriteria
(Criteria newCriteria, Criteria oldCriteria, DSRequest requestProperties, String policy) Default behavior is to callDataSource.compareCriteria()
to determine whether new criteria is guaranteed more restrictive, equivalent to the old criteria, or not guaranteed more restrictive, returning 1, 0 or -1 respectively.create()
void
dataArrived
(int startRow, int endRow) Deprecated.This method is not an override point in SmartGWT.void
Ensures that the underlying SmartClient ResultSet object is created for this ResultSet instance.void
For cases where the exact size of the data set is not known due toprogressiveLoading
, this method may be used to issue an explicit fetch request to the data source, asking for an accurate row count for the criteria currently applied to this ResultSet.void
fetchRowCount
(RowCountCallback callback) void
fetchRowCount
(RowCountCallback callback, DSRequest dsRequest) For cases where the exact size of the data set is not known due toprogressiveLoading
, this method may be used to issue an explicit fetch request to the data source, asking for an accurate row count for the criteria currently applied to this ResultSet.void
Derive the current filtered set of data from the cache of all matching rows.Checks only loaded rows and will not trigger a fetch.Record[]
findAll
(AdvancedCriteria adCriteria) Filters all objects according to the AdvancedCriteria passed and will not trigger a fetch.Record[]
Checks only loaded rows and will not trigger a fetch.Record[]
Checks only loaded rows and will not trigger a fetch.Record[]
Checks only loaded rows and will not trigger a fetch.Record[]
Checks only loaded rows and will not trigger a fetch.Record[]
Checks only loaded rows and will not trigger a fetch.Record[]
Find all objects where property == value in the object.Record[]
Checks only loaded rows and will not trigger a fetch.Attempt to find the record in the resultSet that has a primary key value that matches the passed in parameter value.Attempt to find the record in the resultSet that has a primary key value that matches the passed in parameter value.int
int
int
int
int
int
int
int
findNextIndex
(int startIndex, String propertyName, boolean value, int endIndex) int
findNextIndex
(int startIndex, String propertyName, float value, int endIndex) int
findNextIndex
(int startIndex, String propertyName, int value, int endIndex) int
findNextIndex
(int startIndex, String propertyName, Long value, int endIndex) int
findNextIndex
(int startIndex, String propertyName, String value, int endIndex) int
findNextIndex
(int startIndex, String propertyName, Date value, int endIndex) int
findNextIndex
(int startIndex, Map properties) get
(int pos) Returns the record at the specified position.Returns a list of all rows that have been cached.Record[]
If the complete set of records for a resultSet is available when the resultSet is created, it can be made available to the resultSet via this property at initialization time.Returns a list of the currently visible data, that is, all rows that match the current criteria, with null entries orloading markers
for rows that are not yet loaded or in the process of loading, respectively.If true, records requested only for visible area.boolean
IfprogressiveLoading
is active for a ResultSet we may not know the true size of the data set being displayed.boolean
If this ResultSet does not know its length due toDataSource.progressiveLoading
, should arow count fetch
automatically when data is loaded?boolean
Will therow count fetch operation
block user interaction by havingshowPrompt:true
?int[]
getCachedRange
(int rowNum) Returns the index of the first and last cached row around a given row, or null if the row itself is not cached.Filter criteria used whenever records are retrieved.Decides under what conditions the cache should be dropped when theCriteria
changes.WhatDataSource
is this resultSet associated with?By default when the data of this ResultSet's dataSource is modified, the ResultSet will be updated to display these changes.Whether to discard all cached rows when a modification operation (add, update, remove) occurs on the ResultSet's DataSource.int
Delay in milliseconds before fetching rows.Mode of fetching records from the server.TheoperationId
this ResultSet should use when performing fetch operations.Criteria that are never shown to or edited by the user and are cumulative with any criteria provided viaDataBoundComponent.initialCriteria
,setCriteria()
etc.int
Return the total number of records that match the current filter criteria.static Record
Returns the singleton marker object that is used as a placeholder for records that are being loaded from the server.boolean
When true, allows the ResultSet to be modified by list APIsList.addAt()
,List.set()
, andList.removeAt()
.By default when a row is returned by the server, the currentfilter\n criteria
are applied to it, and it may disappear from the cache.static ResultSet
getOrCreateRef
(JavaScriptObject jsObj) This method returns a Map of config properties suitable for use as the "defaults" attribute of aPaletteNode
.Error message used when the prerequisite generation of missing values in a field was not successful.Setsprogressive loading mode
for this ResultSet.String[]
getProperty
(String property) LikeList.getProperty()
.Record[]
getRange
(int start, int end) Return the items between position start and end, non-inclusive at the end, possibly containing markers for records that haven't loaded yet.getRangeAsRecordList
(int start, int end) Return a RecordList with the items between position start and end, non-inclusive at the end.To avoid needless work, the ResultSet by default doesn't refilter the data when methods such asListGrid.fetchData()
orListGrid.filterData()
are called with unchanged criteria.boolean
IfprogressiveLoading
is not explicitly set, but the ResultSet recieves a response from the server whereDSResponse.progressiveLoading
is set to true, should subsequent requests for other rows in the same data set explicitly request progressiveLoading viaDSRequest.progressiveLoading
, as long as the criteria are unchanged and the cache is not explicitly invalidated?Allows to set a DSRequest properties to this ResulSet.int
How many rows to retrieve at once.int
This method retrieves the row-count for this data set.Request properties for row-count fetch operations performed byfetchRowCount()
.TheoperationId
this ResultSet should use when performing a row-count fetch operation due tofetchRowCount()
.Integer[]
IfgetRowCountStatus()
is "range" this method will return a two element array containing the lower and upper bound for the rowCount.This method indicates whethergetRowCount()
reflects an accurate row-count for this data set.getSort()
Return the current sort-specification for this ResultSet as an Array ofSortSpecifier
s.When a successful Add, Update or Remove type operation fires on this ResultSet's dataSource, ifDSResponse.data
is unset, should we integrate the submitted data values (from the request) into our data-set? This attribute will be passed toDataSource.getUpdatedData()
as theuseDataFromRequest
parameter.If set to true, updated and added rows will be integrated into the client-side cache even if paging is enabled and cache is partial.Whether to filter data locally when we have a complete cache of all DataSource records for the current criteria, and the user further restricts the criteria (seeDataSource.compareCriteria()
).Whether to sort data locally when all records matching the current criteria have been cached.getValueMap
(String idField, String displayField) Get a map of the form{ item[idField] -> item[displayField] }
, for all items in the list.int
Return the position in the list of the first instance of the specified object.int
Return the position in the list of the first instance of the specified object.int
Return the position in the list of the first instance of the specified object.int
int
Return the position in the list of the first instance of the specified object.void
Manually invalidate this ResultSet's cache.static boolean
isResultSet
(JavaScriptObject data) boolean
Whether the ResultSet knows the length of its data set.boolean
Does the length of this ResultSet as returned bygetLength()
reflect thetotalRows
reported by a DataSource withProgressiveLoading
enabled?boolean
rangeIsLoaded
(int startRow, int endRow) Whether the given range of rows has been loaded.void
resort()
Forcibly resort this ResultSet by the current list ofSortSpecifier
s.boolean
rowIsLoaded
(int rowNum) Whether the given row has been loaded.setAllRows
(Record... allRows) If the complete set of records for a resultSet is available when the resultSet is created, it can be made available to the resultSet via this property at initialization time.setAlwaysRequestVisibleRows
(Boolean alwaysRequestVisibleRows) If true, records requested only for visible area.setApplyRowCountToLength
(boolean applyRowCountToLength) IfprogressiveLoading
is active for a ResultSet we may not know the true size of the data set being displayed.setAutoFetchRowCount
(boolean autoFetchRowCount) If this ResultSet does not know its length due toDataSource.progressiveLoading
, should arow count fetch
automatically when data is loaded?setBlockingRowCountFetch
(boolean blockingRowCountFetch) Will therow count fetch operation
block user interaction by havingshowPrompt:true
?setCriteria
(Criteria criteria) Filter criteria used whenever records are retrieved.setCriteriaPolicy
(CriteriaPolicy criteriaPolicy) Decides under what conditions the cache should be dropped when theCriteria
changes.setDataSource
(DataSource dataSource) WhatDataSource
is this resultSet associated with?setDisableCacheSync
(Boolean disableCacheSync) By default when the data of this ResultSet's dataSource is modified, the ResultSet will be updated to display these changes.setDropCacheOnUpdate
(Boolean dropCacheOnUpdate) Whether to discard all cached rows when a modification operation (add, update, remove) occurs on the ResultSet's DataSource.setFetchDelay
(int fetchDelay) Delay in milliseconds before fetching rows.setFetchMode
(FetchMode fetchMode) Mode of fetching records from the server.setFetchOperation
(String fetchOperation) TheoperationId
this ResultSet should use when performing fetch operations.void
setFullLength
(int length) Set the total number of rows available from the server that match the current filter criteria for this ResultSet.setImplicitCriteria
(Criteria implicitCriteria) Criteria that are never shown to or edited by the user and are cumulative with any criteria provided viaDataBoundComponent.initialCriteria
,setCriteria()
etc.setInitialData
(Record... initialData) Initial set of data for the ResultSet.setInitialLength
(Integer initialLength) Initial value of the data set length.void
setInitialSort
(SortSpecifier... sortSpecifiers) Initial multi property sort specification for this ResultSet's data.void
setModifiable
(boolean modifiable) When true, allows the ResultSet to be modified by list APIsList.addAt()
,List.set()
, andList.removeAt()
.setNeverDropUpdatedRows
(Boolean neverDropUpdatedRows) By default when a row is returned by the server, the currentfilter\n criteria
are applied to it, and it may disappear from the cache.setPrerequisiteFieldGenerationNotSuccessfulErrorMessage
(String prerequisiteFieldGenerationNotSuccessfulErrorMessage) Error message used when the prerequisite generation of missing values in a field was not successful.setProgressiveLoading
(Boolean progressiveLoading) Setsprogressive loading mode
for this ResultSet.setReapplyUnchangedLocalFilter
(Boolean reapplyUnchangedLocalFilter) To avoid needless work, the ResultSet by default doesn't refilter the data when methods such asListGrid.fetchData()
orListGrid.filterData()
are called with unchanged criteria.setRememberDynamicProgressiveLoading
(boolean rememberDynamicProgressiveLoading) IfprogressiveLoading
is not explicitly set, but the ResultSet recieves a response from the server whereDSResponse.progressiveLoading
is set to true, should subsequent requests for other rows in the same data set explicitly request progressiveLoading viaDSRequest.progressiveLoading
, as long as the criteria are unchanged and the cache is not explicitly invalidated?setRequestProperties
(DSRequest requestProperties) Allows to set a DSRequest properties to this ResulSet.setResultSize
(int resultSize) How many rows to retrieve at once.setRowCountContext
(DSRequest rowCountContext) Request properties for row-count fetch operations performed byfetchRowCount()
.setRowCountOperation
(String rowCountOperation) TheoperationId
this ResultSet should use when performing a row-count fetch operation due tofetchRowCount()
.void
setSort()
Sort this ResultSet by the passed list ofSortSpecifier
s.setSortSpecifiers
(SortSpecifier... sortSpecifiers) Initial sort specifiers for a ResultSet.setUpdateCacheFromRequest
(Boolean updateCacheFromRequest) When a successful Add, Update or Remove type operation fires on this ResultSet's dataSource, ifDSResponse.data
is unset, should we integrate the submitted data values (from the request) into our data-set? This attribute will be passed toDataSource.getUpdatedData()
as theuseDataFromRequest
parameter.setUpdatePartialCache
(Boolean updatePartialCache) If set to true, updated and added rows will be integrated into the client-side cache even if paging is enabled and cache is partial.setUseClientFiltering
(Boolean useClientFiltering) Whether to filter data locally when we have a complete cache of all DataSource records for the current criteria, and the user further restricts the criteria (seeDataSource.compareCriteria()
).setUseClientSorting
(Boolean useClientSorting) Whether to sort data locally when all records matching the current criteria have been cached.sortByProperty
(String property, boolean up) Sort this ResultSet by a property of each record.sortByProperty
(String property, boolean up, Function normalizer) sortByProperty
(String property, boolean up, Function normalizer, Object context) Sort this ResultSet by a property of each record.boolean
unsort()
Clear anysort specifiers
applied to this ResultSet, while maintaining the current order of records.boolean
Determine whether the ResultSet is showing a filtered, proper subset of the cached rows.boolean
willFetchData
(Criteria newCriteria) Will changing the criteria for this resultSet require fetching new data from the server, or can the new criteria be satisfied from data already cached on the client?
SecondtextMatchStyle
parameter determines whether a change of text-match style will require a server fetch - for example if filter is being changed between an exact match (from e.g:ListGrid.fetchData()
) and a substring match (from e.g:ListGrid.filterData()
).
This method can be used to determine whetherListGrid.fetchData()
orListGrid.filterData()
would cause a server side fetch when passed a certain set of criteria.boolean
willFetchData
(Criteria newCriteria, TextMatchStyle textMatchStyle) Will changing the criteria for this resultSet require fetching new data from the server, or can the new criteria be satisfied from data already cached on the client?
SecondtextMatchStyle
parameter determines whether a change of text-match style will require a server fetch - for example if filter is being changed between an exact match (from e.g:ListGrid.fetchData()
) and a substring match (from e.g:ListGrid.filterData()
).
This method can be used to determine whetherListGrid.fetchData()
orListGrid.filterData()
would cause a server side fetch when passed a certain set of criteria.Methods inherited from class com.smartgwt.client.data.RecordList
add, addAt, addDataChangedHandler, addList, addList, addListAt, contains, contains, containsAll, duplicate, equals, find, find, find, find, findIndex, findNextIndex, findNextIndex, findNextIndex, first, getItems, getJsObj, getOrCreateJsObj, getRangeList, intersect, isARecordList, isCreated, isEmpty, last, lastIndexOf, lastIndexOf, remove, removeAt, removeList, set, setLength, setSort, sort, sort, sortByProperty, toArray
Methods inherited from class com.smartgwt.client.core.BaseClass
addDynamicProperty, addDynamicProperty, addDynamicProperty, addDynamicProperty, applyFactoryProperties, clearDynamicProperty, createJsObj, destroy, doAddHandler, doInit, error, error, errorIfNotCreated, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsString, getAttributeAsStringArray, getClassName, getConfig, getHandlerCount, getID, getRef, getRuleScope, getScClassName, getTestInstance, hasAutoAssignedID, hasDynamicProperty, internalSetID, internalSetID, isConfigOnly, isFactoryCreated, onBind, onInit, registerID, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setConfig, setConfigOnly, setFactoryCreated, setID, setProperty, setProperty, setProperty, setProperty, setRuleScope, setScClassName
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
-
Constructor Details
-
ResultSet
public ResultSet() -
ResultSet
-
ResultSet
-
-
Method Details
-
getOrCreateRef
-
setJavaScriptObject
- Overrides:
setJavaScriptObject
in classBaseClass
-
create
- Overrides:
create
in classRecordList
-
setAllRows
If the complete set of records for a resultSet is available when the resultSet is created, it can be made available to the resultSet via this property at initialization time. This data will then be considered cached meaning sorting and filtering can occur on the client (no need for server fetch).This cached data can be dropped via a call to
invalidateCache()
.See also
initialData
andinitialLength
as an alternative approach for initializing a ResultSet with a partial cache, such that data paging will occur as uncached rows are requested.Note that developers wishing to synchronously access a filtered set of client side data may wish to consider creating a
FilteredList
.
If this method is called after the component has been drawn/initialized: Update theallRows
client-side cache of data at runtime.This method is useful for cases where a full, unfiltered set of data is present on the client and developers wish to filter that data-set locally without going through a fetch operation against a DataSource.
Developers using this pattern may also wish to consider the
FilteredList
class.Note : This is an advanced setting
- Parameters:
allRows
- New set of unfiltered cache data. Default value is null- Returns:
ResultSet
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getAllRows
If the complete set of records for a resultSet is available when the resultSet is created, it can be made available to the resultSet via this property at initialization time. This data will then be considered cached meaning sorting and filtering can occur on the client (no need for server fetch).This cached data can be dropped via a call to
invalidateCache()
.See also
initialData
andinitialLength
as an alternative approach for initializing a ResultSet with a partial cache, such that data paging will occur as uncached rows are requested.Note that developers wishing to synchronously access a filtered set of client side data may wish to consider creating a
FilteredList
.- Returns:
- Current allRows value. Default value is null
-
setAlwaysRequestVisibleRows
public ResultSet setAlwaysRequestVisibleRows(Boolean alwaysRequestVisibleRows) throws IllegalStateException If true, records requested only for visible area.Note : This is an advanced setting
- Parameters:
alwaysRequestVisibleRows
- New alwaysRequestVisibleRows value. Default value is false- Returns:
ResultSet
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getAlwaysRequestVisibleRows
If true, records requested only for visible area.- Returns:
- Current alwaysRequestVisibleRows value. Default value is false
-
setApplyRowCountToLength
public ResultSet setApplyRowCountToLength(boolean applyRowCountToLength) throws IllegalStateException IfprogressiveLoading
is active for a ResultSet we may not know the true size of the data set being displayed.However the exact length may be known thanks to
DSResponse.estimatedTotalRows
containing an exact row count, or due to an explicitrow count fetch
having been performed.If we have an accurate, exact row count, should this be applied to our
length
automatically? Doing so means that if this ResultSet is displayed in aListGrid
, the scrollable area will reflect the true size of the data set and the user may drag-scroll all the way to the end of this data set. Depending on how the server side data storage is implemented and the generated request, requesting row ranges starting at a very large index can be expensive, so this is not always desirable.Note that developers may always explicitly tell a ResultSet the true size of its data set while progressive loading is active via
setFullLength()
Note : This is an advanced setting
- Parameters:
applyRowCountToLength
- New applyRowCountToLength value. Default value is false- Returns:
ResultSet
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created- See Also:
-
getApplyRowCountToLength
public boolean getApplyRowCountToLength()IfprogressiveLoading
is active for a ResultSet we may not know the true size of the data set being displayed.However the exact length may be known thanks to
DSResponse.estimatedTotalRows
containing an exact row count, or due to an explicitrow count fetch
having been performed.If we have an accurate, exact row count, should this be applied to our
length
automatically? Doing so means that if this ResultSet is displayed in aListGrid
, the scrollable area will reflect the true size of the data set and the user may drag-scroll all the way to the end of this data set. Depending on how the server side data storage is implemented and the generated request, requesting row ranges starting at a very large index can be expensive, so this is not always desirable.Note that developers may always explicitly tell a ResultSet the true size of its data set while progressive loading is active via
setFullLength()
- Returns:
- Current applyRowCountToLength value. Default value is false
- See Also:
-
setAutoFetchRowCount
If this ResultSet does not know its length due toDataSource.progressiveLoading
, should arow count fetch
automatically when data is loaded?The fetch will be issued when the first page of data arrives from the server as part of a progressive-loading response. If the cache is invalidated or the criteria change, a new row count fetch will be issued automatically when new data arrives that does not have an accurate row count.
- Parameters:
autoFetchRowCount
- New autoFetchRowCount value. Default value is false- Returns:
ResultSet
instance, for chaining setter calls
-
getAutoFetchRowCount
public boolean getAutoFetchRowCount()If this ResultSet does not know its length due toDataSource.progressiveLoading
, should arow count fetch
automatically when data is loaded?The fetch will be issued when the first page of data arrives from the server as part of a progressive-loading response. If the cache is invalidated or the criteria change, a new row count fetch will be issued automatically when new data arrives that does not have an accurate row count.
- Returns:
- Current autoFetchRowCount value. Default value is false
-
setBlockingRowCountFetch
public ResultSet setBlockingRowCountFetch(boolean blockingRowCountFetch) throws IllegalStateException Will therow count fetch operation
block user interaction by havingshowPrompt:true
?- Parameters:
blockingRowCountFetch
- New blockingRowCountFetch value. Default value is true- Returns:
ResultSet
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created- See Also:
-
getBlockingRowCountFetch
public boolean getBlockingRowCountFetch()Will therow count fetch operation
block user interaction by havingshowPrompt:true
?- Returns:
- Current blockingRowCountFetch value. Default value is true
- See Also:
-
setCriteria
Filter criteria used whenever records are retrieved.Use
setCriteria()
to change the criteria after initialization.
If this method is called after the component has been drawn/initialized: Set the filter criteria to use when fetching rows.Depending on the result of
compareCriteria()
and settings foruseClientFiltering
/FetchMode
, setting criteria may cause a trip to the server to get a new set of rows, or may simply cause already-fetched rows to be re-filtered according to the new Criteria. In either case, the dataset length available fromgetLength()
may change and rows will appear at different indices.The filter criteria can be changed while server fetches for data matching the old criteria are still outstanding. If this is the case, the ResultSet will make sure that any records received matching the old criteria are not added to the cache for the new criteria. Any callbacks for responses to the outstanding requests are fired as normal, and the responses'
totalRows
counts are kept (as they are still potentially meaningful to components using the ResultSet), but the response data is cleared so that it won't be used inadvertently as data matching the new criteria.Note: for simple Criteria, any field values in the criteria explicitly specified as null will be passed to the server. By default the server then returns only records whose value is null for that field. This differs from certain higher level methods such as
ListGrid.fetchData()
which prune null criteria fields before performing a fetch operation.- Parameters:
criteria
- the filter criteria. Default value is null- Returns:
ResultSet
instance, for chaining setter calls
-
getCriteria
Filter criteria used whenever records are retrieved.Use
setCriteria()
to change the criteria after initialization.- Returns:
- Get the current criteria for this ResultSet. Default value is null
-
setCriteriaPolicy
Decides under what conditions the cache should be dropped when theCriteria
changes.Note : This is an advanced setting
- Parameters:
criteriaPolicy
- New criteriaPolicy value. Default value is null- Returns:
ResultSet
instance, for chaining setter calls- See Also:
-
getCriteriaPolicy
Decides under what conditions the cache should be dropped when theCriteria
changes.- Returns:
- Current criteriaPolicy value. Default value is null
- See Also:
-
setDataSource
WhatDataSource
is this resultSet associated with?- Parameters:
dataSource
- New dataSource value. Default value is null- Returns:
ResultSet
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created- See Also:
-
getDataSource
WhatDataSource
is this resultSet associated with?- Returns:
- Current dataSource value. Default value is null
- See Also:
-
setDisableCacheSync
By default when the data of this ResultSet's dataSource is modified, the ResultSet will be updated to display these changes. Set this flag to true to disable this behavior.Note : This is an advanced setting
- Parameters:
disableCacheSync
- New disableCacheSync value. Default value is false- Returns:
ResultSet
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getDisableCacheSync
By default when the data of this ResultSet's dataSource is modified, the ResultSet will be updated to display these changes. Set this flag to true to disable this behavior.- Returns:
- Current disableCacheSync value. Default value is false
-
setDropCacheOnUpdate
Whether to discard all cached rows when a modification operation (add, update, remove) occurs on the ResultSet's DataSource.A ResultSet that has a complete cache for the current filter criteria can potentially incorporate a newly created or updated row based on the data that the server returns when a modification operation completes. However this is not always possible for ResultSets that show some types of joins, or when the server cannot easily return update data. In this case set
dropCacheOnUpdate
to cause the cache to be discarded when an update occurs.dropCacheOnUpdate
can be set either directly on a ResultSet, or on a DataSource in order to affect all ResultSets on that DataSource.Note : This is an advanced setting
- Parameters:
dropCacheOnUpdate
- New dropCacheOnUpdate value. Default value is false- Returns:
ResultSet
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getDropCacheOnUpdate
Whether to discard all cached rows when a modification operation (add, update, remove) occurs on the ResultSet's DataSource.A ResultSet that has a complete cache for the current filter criteria can potentially incorporate a newly created or updated row based on the data that the server returns when a modification operation completes. However this is not always possible for ResultSets that show some types of joins, or when the server cannot easily return update data. In this case set
dropCacheOnUpdate
to cause the cache to be discarded when an update occurs.dropCacheOnUpdate
can be set either directly on a ResultSet, or on a DataSource in order to affect all ResultSets on that DataSource.- Returns:
- Current dropCacheOnUpdate value. Default value is false
-
setFetchDelay
Delay in milliseconds before fetching rows.When a get() or getRange() call asked for rows that haven't been loaded, the ResultSet will wait before actually triggering the request. If, during the delay, more get() or getRange() calls are made for missing rows, the final fetch to the server will reflect the most recently requested rows.
The intent of this delay is to avoid triggering many unnecessary fetches during drag-scrolling and similar user interactions.
Note : This is an advanced setting
- Parameters:
fetchDelay
- New fetchDelay value. Default value is 0- Returns:
ResultSet
instance, for chaining setter calls
-
getFetchDelay
public int getFetchDelay()Delay in milliseconds before fetching rows.When a get() or getRange() call asked for rows that haven't been loaded, the ResultSet will wait before actually triggering the request. If, during the delay, more get() or getRange() calls are made for missing rows, the final fetch to the server will reflect the most recently requested rows.
The intent of this delay is to avoid triggering many unnecessary fetches during drag-scrolling and similar user interactions.
- Returns:
- Current fetchDelay value. Default value is 0
-
setFetchMode
Mode of fetching records from the server. If unset, will default to"local"
ifallRows
is specified, otherwise"paged"
.Note : This is an advanced setting
- Parameters:
fetchMode
- New fetchMode value. Default value is null- Returns:
ResultSet
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created- See Also:
-
getFetchMode
Mode of fetching records from the server. If unset, will default to"local"
ifallRows
is specified, otherwise"paged"
.- Returns:
- Current fetchMode value. Default value is null
- See Also:
-
setFetchOperation
TheoperationId
this ResultSet should use when performing fetch operations.Note: if this property is not explicitly set and, for ResultSets automatically created by a component,
DataBoundComponent.fetchOperation
is also unset, a placeholder value of <dataSourceId>_<operationType> may be reported (e.g. "supplyItem_fetch").- Parameters:
fetchOperation
- New fetchOperation value. Default value is null- Returns:
ResultSet
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getFetchOperation
TheoperationId
this ResultSet should use when performing fetch operations.Note: if this property is not explicitly set and, for ResultSets automatically created by a component,
DataBoundComponent.fetchOperation
is also unset, a placeholder value of <dataSourceId>_<operationType> may be reported (e.g. "supplyItem_fetch").- Returns:
- Current fetchOperation value. Default value is null
-
setImplicitCriteria
Criteria that are never shown to or edited by the user and are cumulative with any criteria provided viaDataBoundComponent.initialCriteria
,setCriteria()
etc.- Parameters:
implicitCriteria
- New implicitCriteria value. Default value is null- Returns:
ResultSet
instance, for chaining setter calls
-
getImplicitCriteria
Criteria that are never shown to or edited by the user and are cumulative with any criteria provided viaDataBoundComponent.initialCriteria
,setCriteria()
etc.- Returns:
- Current implicitCriteria value. Default value is null
-
setInitialData
Initial set of data for the ResultSet.This data will be treated exactly as though it were the data returned from the ResultSet's first server fetch.
By default,
initialData
will be considered a complete response (all rows that match theCriteria
which the ResultSet was initialized with).Set
initialLength
to treatinitialData
as a partial response, equivalent to receiving aDSResponse
withstartRow:0
,endRow:initialData.length
andtotalRows:initialLength
. Normal data paging will then occur if data is requested for row indices not filled viainitialData
.initialData
may be provided as a "sparse" array, that is, slots may be left null indicating rows that have not been loaded. In this way you can create a ResultSet that is missing rows at the beginning of the dataset, but has loaded rows toward the end, so that you can create a component that is scrolled to a particular position of a dataset without loading rows at the beginning.To keep the logic simple and support partial
initialData
, the data is assumed to be already sorted and filtered according to thesortSpecifiers
andcriteria
supplied to the ResultSet, since otherwise, for partialinitialData
, sorting or filtering would immediately cause the data to be discarded.If
initialData
is complete and needs to be sorted or filtered, then don't pass thesortSpecifiers
orcriteria
, respectively, when creating the ResultSet. Instead, callsetCriteria()
orsetSort()
, respectively, on the instance afterwards.Note : This is an advanced setting
- Parameters:
initialData
- New initialData value. Default value is null- Returns:
ResultSet
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created- See Also:
-
setInitialLength
Initial value of the data set length.To create a ResultSet with it's cache partly filled, see
initialData
.Note : This is an advanced setting
- Parameters:
initialLength
- New initialLength value. Default value is null- Returns:
ResultSet
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
setModifiable
When true, allows the ResultSet to be modified by list APIsList.addAt()
,List.set()
, andList.removeAt()
. Only applies tofetchMode
:"local" ResultSets, since in all other cases, such modifications would break the consistency of server and client row numbering needed for data paging, and also create some issues with automatic cache synchronization. See the "Modifying ResultSets" subtopic in theResultSet Overview
for the alternative approach of updating theDataSource
.One known case where modification can be useful is when an array has been passed to
ListGrid.setData()
for a ListGrid withListGrid.filterLocalData
:true. If the data is filtered using thefilterEditor
, then a new local ResultSet will be created asdata
to reflect the filtering.- Parameters:
modifiable
- New modifiable value. Default value is false- Returns:
ResultSet
instance, for chaining setter calls- See Also:
-
getModifiable
public boolean getModifiable()When true, allows the ResultSet to be modified by list APIsList.addAt()
,List.set()
, andList.removeAt()
. Only applies tofetchMode
:"local" ResultSets, since in all other cases, such modifications would break the consistency of server and client row numbering needed for data paging, and also create some issues with automatic cache synchronization. See the "Modifying ResultSets" subtopic in theResultSet Overview
for the alternative approach of updating theDataSource
.One known case where modification can be useful is when an array has been passed to
ListGrid.setData()
for a ListGrid withListGrid.filterLocalData
:true. If the data is filtered using thefilterEditor
, then a new local ResultSet will be created asdata
to reflect the filtering.- Returns:
- Current modifiable value. Default value is false
- See Also:
-
setNeverDropUpdatedRows
By default when a row is returned by the server, the currentfilter\n criteria
are applied to it, and it may disappear from the cache.Set this flag to true to disable this behavior.
Note : This is an advanced setting
- Parameters:
neverDropUpdatedRows
- New neverDropUpdatedRows value. Default value is false- Returns:
ResultSet
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getNeverDropUpdatedRows
By default when a row is returned by the server, the currentfilter\n criteria
are applied to it, and it may disappear from the cache.Set this flag to true to disable this behavior.
- Returns:
- Current neverDropUpdatedRows value. Default value is false
-
setPrerequisiteFieldGenerationNotSuccessfulErrorMessage
public ResultSet setPrerequisiteFieldGenerationNotSuccessfulErrorMessage(String prerequisiteFieldGenerationNotSuccessfulErrorMessage) Error message used when the prerequisite generation of missing values in a field was not successful.- Parameters:
prerequisiteFieldGenerationNotSuccessfulErrorMessage
- New prerequisiteFieldGenerationNotSuccessfulErrorMessage value. Default value is "The generation of missing values for the ${fieldTitle} field was not successful: ${errorMessage}"- Returns:
ResultSet
instance, for chaining setter calls- See Also:
-
getPrerequisiteFieldGenerationNotSuccessfulErrorMessage
Error message used when the prerequisite generation of missing values in a field was not successful.- Returns:
- Current prerequisiteFieldGenerationNotSuccessfulErrorMessage value. Default value is "The generation of missing values for the ${fieldTitle} field was not successful: ${errorMessage}"
- See Also:
-
setProgressiveLoading
Setsprogressive loading mode
for this ResultSet. AnyDSRequest
s issued by this ResultSet will copy this setting onto the request, overriding the OperationBinding- and DataSource-level settings.This setting is applied automatically by
DataBoundComponent
s that have their own explicit setting forprogressiveLoading
See also the
rememberDynamicProgressiveLoading
attribute.- Parameters:
progressiveLoading
- New progressiveLoading value. Default value is null- Returns:
ResultSet
instance, for chaining setter calls- See Also:
-
getProgressiveLoading
Setsprogressive loading mode
for this ResultSet. AnyDSRequest
s issued by this ResultSet will copy this setting onto the request, overriding the OperationBinding- and DataSource-level settings.This setting is applied automatically by
DataBoundComponent
s that have their own explicit setting forprogressiveLoading
See also the
rememberDynamicProgressiveLoading
attribute.- Returns:
- Current progressiveLoading value. Default value is null
- See Also:
-
setReapplyUnchangedLocalFilter
To avoid needless work, the ResultSet by default doesn't refilter the data when methods such asListGrid.fetchData()
orListGrid.filterData()
are called with unchanged criteria. However, this property can be set true for backward compatibility to force refiltering if we'refiltering locally
and the criteria haven't changed. but are narrower than the criteria used to fetch the current cache.Going forward, we may deprecate this property, so you should move to approach that doesn't require such notification in the case of unchanged criteria.
Note : This is an advanced setting
- Parameters:
reapplyUnchangedLocalFilter
- New reapplyUnchangedLocalFilter value. Default value is null- Returns:
ResultSet
instance, for chaining setter calls- See Also:
-
getReapplyUnchangedLocalFilter
To avoid needless work, the ResultSet by default doesn't refilter the data when methods such asListGrid.fetchData()
orListGrid.filterData()
are called with unchanged criteria. However, this property can be set true for backward compatibility to force refiltering if we'refiltering locally
and the criteria haven't changed. but are narrower than the criteria used to fetch the current cache.Going forward, we may deprecate this property, so you should move to approach that doesn't require such notification in the case of unchanged criteria.
- Returns:
- Current reapplyUnchangedLocalFilter value. Default value is null
- See Also:
-
setRememberDynamicProgressiveLoading
IfprogressiveLoading
is not explicitly set, but the ResultSet recieves a response from the server whereDSResponse.progressiveLoading
is set to true, should subsequent requests for other rows in the same data set explicitly request progressiveLoading viaDSRequest.progressiveLoading
, as long as the criteria are unchanged and the cache is not explicitly invalidated?This property is useful for the case where the server side
DataSource.progressiveLoadingThreshold
enabled progressive loading after the row-count query determined that the requested data set was very large. By explicitlyrequesting progressive loading
for subsequent fetches the server is able to avoid an unnecessary and potentially expensive row-count query while returning other rows from the same data set.- Parameters:
rememberDynamicProgressiveLoading
- New rememberDynamicProgressiveLoading value. Default value is true- Returns:
ResultSet
instance, for chaining setter calls- See Also:
-
getRememberDynamicProgressiveLoading
public boolean getRememberDynamicProgressiveLoading()IfprogressiveLoading
is not explicitly set, but the ResultSet recieves a response from the server whereDSResponse.progressiveLoading
is set to true, should subsequent requests for other rows in the same data set explicitly request progressiveLoading viaDSRequest.progressiveLoading
, as long as the criteria are unchanged and the cache is not explicitly invalidated?This property is useful for the case where the server side
DataSource.progressiveLoadingThreshold
enabled progressive loading after the row-count query determined that the requested data set was very large. By explicitlyrequesting progressive loading
for subsequent fetches the server is able to avoid an unnecessary and potentially expensive row-count query while returning other rows from the same data set.- Returns:
- Current rememberDynamicProgressiveLoading value. Default value is true
- See Also:
-
setRequestProperties
Allows to set a DSRequest properties to this ResulSet.- Parameters:
requestProperties
- New requestProperties value. Default value is null- Returns:
ResultSet
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getRequestProperties
Allows to set a DSRequest properties to this ResulSet.- Returns:
- Current requestProperties value. Default value is null
-
setResultSize
How many rows to retrieve at once.Applicable only with
fetchMode: "paged"
. When a paged ResultSet is asked for rows that have not yet been loaded, it will fetch adjacent rows that are likely to be required soon, in batches of this size.Note : This is an advanced setting
- Parameters:
resultSize
- New resultSize value. Default value is 75- Returns:
ResultSet
instance, for chaining setter calls
-
getResultSize
public int getResultSize()How many rows to retrieve at once.Applicable only with
fetchMode: "paged"
. When a paged ResultSet is asked for rows that have not yet been loaded, it will fetch adjacent rows that are likely to be required soon, in batches of this size.- Returns:
- Current resultSize value. Default value is 75
-
setRowCountContext
Request properties for row-count fetch operations performed byfetchRowCount()
.The row-count fetch operation will ultimately be constructed as follows:
- Default operation
properties will be constructed by combining the
rowCountContext
with theresultSet context
, with rowCountContext properties taking precedence - The operation will have type "fetch" and
DSRequest.startRow
andDSRequest.endRow
set to zero, andDSRequest.progressiveLoading
will be explicitly set to false. The request will also haveDSRequest.showPrompt
set toblockingRowCountFetch
so user interactions can be blocked while the row count is actively being performed. - To override these defaults or specify additional
properties, developers may use the
dsRequest
parameter of thefetchRowCount()
method.
Note : This is an advanced setting
- Parameters:
rowCountContext
- New rowCountContext value. Default value is null- Returns:
ResultSet
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created- See Also:
- Default operation
properties will be constructed by combining the
-
getRowCountContext
Request properties for row-count fetch operations performed byfetchRowCount()
.The row-count fetch operation will ultimately be constructed as follows:
- Default operation
properties will be constructed by combining the
rowCountContext
with theresultSet context
, with rowCountContext properties taking precedence - The operation will have type "fetch" and
DSRequest.startRow
andDSRequest.endRow
set to zero, andDSRequest.progressiveLoading
will be explicitly set to false. The request will also haveDSRequest.showPrompt
set toblockingRowCountFetch
so user interactions can be blocked while the row count is actively being performed. - To override these defaults or specify additional
properties, developers may use the
dsRequest
parameter of thefetchRowCount()
method.
- Returns:
- Current rowCountContext value. Default value is null
- See Also:
- Default operation
properties will be constructed by combining the
-
setRowCountOperation
TheoperationId
this ResultSet should use when performing a row-count fetch operation due tofetchRowCount()
.See also
rowCountContext
- Parameters:
rowCountOperation
- New rowCountOperation value. Default value is null- Returns:
ResultSet
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created- See Also:
-
getRowCountOperation
TheoperationId
this ResultSet should use when performing a row-count fetch operation due tofetchRowCount()
.See also
rowCountContext
- Returns:
- Current rowCountOperation value. Default value is null
- See Also:
-
setSortSpecifiers
Initial sort specifiers for a ResultSet. UsesetSort()
andgetSort()
to sort the data after initialization rather than attempting to read or modify this property directly.Note: if
initialData
was specified, the data is assumed to already be sorted to match this sort configuration.Note : This is an advanced setting
- Parameters:
sortSpecifiers
- New sortSpecifiers value. Default value is null- Returns:
ResultSet
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
setUpdateCacheFromRequest
public ResultSet setUpdateCacheFromRequest(Boolean updateCacheFromRequest) throws IllegalStateException When a successful Add, Update or Remove type operation fires on this ResultSet's dataSource, ifDSResponse.data
is unset, should we integrate the submitted data values (from the request) into our data-set? This attribute will be passed toDataSource.getUpdatedData()
as theuseDataFromRequest
parameter.Note : This is an advanced setting
- Parameters:
updateCacheFromRequest
- New updateCacheFromRequest value. Default value is true- Returns:
ResultSet
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getUpdateCacheFromRequest
When a successful Add, Update or Remove type operation fires on this ResultSet's dataSource, ifDSResponse.data
is unset, should we integrate the submitted data values (from the request) into our data-set? This attribute will be passed toDataSource.getUpdatedData()
as theuseDataFromRequest
parameter.- Returns:
- Current updateCacheFromRequest value. Default value is true
-
setUpdatePartialCache
If set to true, updated and added rows will be integrated into the client-side cache even if paging is enabled and cache is partial. IfupdatePartialCache
is false, the cache will be invalidated and new data fetched.If updatePartialCache is enabled and an "add" or "update" operation succeeds with a partial cache:
- updated rows will remain in their current position. No attempt will be made to sort them into a new position even if the sort field was updated.
- newly added rows will be added at either the end (first preference) or beginning of the dataset if that part of the dataset is cached and was most recently requested. If not, the new row is added at the end of the most recently requested contiguously cached range.
Note : This is an advanced setting
- Parameters:
updatePartialCache
- New updatePartialCache value. Default value is true- Returns:
ResultSet
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getUpdatePartialCache
If set to true, updated and added rows will be integrated into the client-side cache even if paging is enabled and cache is partial. IfupdatePartialCache
is false, the cache will be invalidated and new data fetched.If updatePartialCache is enabled and an "add" or "update" operation succeeds with a partial cache:
- updated rows will remain in their current position. No attempt will be made to sort them into a new position even if the sort field was updated.
- newly added rows will be added at either the end (first preference) or beginning of the dataset if that part of the dataset is cached and was most recently requested. If not, the new row is added at the end of the most recently requested contiguously cached range.
- Returns:
- Current updatePartialCache value. Default value is true
-
setUseClientFiltering
Whether to filter data locally when we have a complete cache of all DataSource records for the current criteria, and the user further restricts the criteria (seeDataSource.compareCriteria()
).This may need to be disabled if client-side filtering differs from server-side filtering in a way that affects functionality or is surprising.
Note that you can also prevent client-side filtering for certain fields, by setting them to
filterOn: 'serverOnly'
.This setting is distinct from
fetchMode:"local"
, which explicitly loads all available DataSource records up front and always performs all filtering on the client.See
applyFilter()
for default filtering behavior.NOTE: even with useClientFiltering false, client-side filtering will be used during cache sync to determine if an updated or added row matches the current criteria. To avoid relying on client-side filtering in this case, either:
- avoid returning update data when the updated row doesn't match the current filter
- set dropCacheOnUpdate
Note : This is an advanced setting
- Parameters:
useClientFiltering
- New useClientFiltering value. Default value is true- Returns:
ResultSet
instance, for chaining setter calls
-
getUseClientFiltering
Whether to filter data locally when we have a complete cache of all DataSource records for the current criteria, and the user further restricts the criteria (seeDataSource.compareCriteria()
).This may need to be disabled if client-side filtering differs from server-side filtering in a way that affects functionality or is surprising.
Note that you can also prevent client-side filtering for certain fields, by setting them to
filterOn: 'serverOnly'
.This setting is distinct from
fetchMode:"local"
, which explicitly loads all available DataSource records up front and always performs all filtering on the client.See
applyFilter()
for default filtering behavior.NOTE: even with useClientFiltering false, client-side filtering will be used during cache sync to determine if an updated or added row matches the current criteria. To avoid relying on client-side filtering in this case, either:
- avoid returning update data when the updated row doesn't match the current filter
- set dropCacheOnUpdate- Returns:
- Current useClientFiltering value. Default value is true
-
setUseClientSorting
Whether to sort data locally when all records matching the current criteria have been cached.This may need to be disabled if client-side sort order differs from server-side sort order in a way that affects functionality or is surprising.
Note : This is an advanced setting
- Parameters:
useClientSorting
- New useClientSorting value. Default value is true- Returns:
ResultSet
instance, for chaining setter calls
-
getUseClientSorting
Whether to sort data locally when all records matching the current criteria have been cached.This may need to be disabled if client-side sort order differs from server-side sort order in a way that affects functionality or is surprising.
- Returns:
- Current useClientSorting value. Default value is true
-
allMatchingRowsCached
public boolean allMatchingRowsCached()Do we have a complete client-side cache of records for the current filter criteria?Returns
false
if this is a paged data set, and the entire set of records that match the current criteria has not been retrieved from the server. In other words, a return value offalse
means that thisResultSet
has a partial cache.- Returns:
- whether all matching rows are cached
-
allRowsCached
public boolean allRowsCached()Do we have a complete client-side cache of all records for this DataSource?Becomes true only when the ResultSet obtains a complete cache after a fetch with empty criteria.
- Returns:
- whether all rows are cached
-
applyFilter
The ResultSet will call applyFilter() when it needs to determine whether rows match the current filter criteria.Default behavior is to call
DataSource.applyFilter()
to determine which rows match that provided criteria.Override this method or
DataSource.applyFilter()
to implement your own client-side filtering behavior.- Parameters:
data
- the list of rowscriteria
- the filter criteria- Returns:
- the list of matching rows
-
applyFilter
The ResultSet will call applyFilter() when it needs to determine whether rows match the current filter criteria.Default behavior is to call
DataSource.applyFilter()
to determine which rows match that provided criteria.Override this method or
DataSource.applyFilter()
to implement your own client-side filtering behavior.- Parameters:
data
- the list of rowscriteria
- the filter criteriarequestProperties
- dataSource request properties- Returns:
- the list of matching rows
-
compareCriteria
Default behavior is to callDataSource.compareCriteria()
to determine whether new criteria is guaranteed more restrictive, equivalent to the old criteria, or not guaranteed more restrictive, returning 1, 0 or -1 respectively. SeeDataSource.compareCriteria()
for a full explanation of the default behavior.Override this method or
DataSource.compareCriteria()
to implement your own client-side filtering behavior.- Parameters:
newCriteria
- new filter criteriaoldCriteria
- old filter criteria- Returns:
- 0 if the filters are equivalent, 1 if newFilter is guaranteed more restrictive, and -1 if newFilter is not guaranteed more restrictive
- See Also:
-
compareCriteria
-
compareCriteria
public int compareCriteria(Criteria newCriteria, Criteria oldCriteria, DSRequest requestProperties, String policy) Default behavior is to callDataSource.compareCriteria()
to determine whether new criteria is guaranteed more restrictive, equivalent to the old criteria, or not guaranteed more restrictive, returning 1, 0 or -1 respectively. SeeDataSource.compareCriteria()
for a full explanation of the default behavior.Override this method or
DataSource.compareCriteria()
to implement your own client-side filtering behavior.- Parameters:
newCriteria
- new filter criteriaoldCriteria
- old filter criteriarequestProperties
- dataSource request propertiespolicy
- overridesCriteriaPolicy
- Returns:
- 0 if the filters are equivalent, 1 if newFilter is guaranteed more restrictive, and -1 if newFilter is not guaranteed more restrictive
- See Also:
-
addDataArrivedHandler
Add a dataArrived handler.Notification fired when data has arrived from the server and has been successfully integrated into the cache.
When
dataArrived()
fires, an immediate call togetRange()
with thestartRow
andendRow
passed as arguments will return a List with noloading markers
.Note that
dataArrived()
won't fire in the case of the owning component filtering with unchanged criteria (for example usingListGrid.fetchData()
orListGrid.filterData()
). To support backward compatibility, the propertyResultSet.reapplyUnchangedLocalFilter
can be set to forcedataArrived()
to be called if the ResultSet isfiltering locally
and the criteria haven't changed but are narrower than the criteria used to fetch the current cache.- Specified by:
addDataArrivedHandler
in interfaceHasDataArrivedHandlers
- Parameters:
handler
- the dataArrived handler- Returns:
HandlerRegistration
used to remove this handler
-
fetchRowCount
public void fetchRowCount()For cases where the exact size of the data set is not known due toprogressiveLoading
, this method may be used to issue an explicit fetch request to the data source, asking for an accurate row count for the criteria currently applied to this ResultSet. The row count will then be available viagetRowCount()
, and ifapplyRowCountToLength
is true, thelength
of the ResultSet will be updated to reflect the reported value.If the
criteria
for the ResultSet change while a row count fetch is in progress, therowCount
for the resultSet will not be updated. In this case the callback passed to this method will still fire, with the criteriaChanged parameter set totrue
Note the fetch request sent to the dataSource will have
DSRequest.progressiveLoading
explicitly set to false andstartRow:0
andendRow:0
. SeerowCountContext
for full details of the request that will be sent to the dataSource.Smart GWT server side dataSources will process such a request by calculating the row-count (for
serverType:"sql"
, this means issuing a row-count database query), skipping any logic to retrieve actual data, and return a response withprogressiveLoading:false
and an accurateDSResponse.totalRows
.If this ResultSet is backed by a custom dataSource implementation, it is recommended that the dataSource either also returns a response with
progressiveLoading:false
and an accurateDSResponse.totalRows
, or uses theDSResponse.estimatedTotalRows
attribute to indicate an accurate row count for the data set.The fetch issued by this method will be marked as a
background request
.- See Also:
-
fetchRowCount
- See Also:
-
fetchRowCount
For cases where the exact size of the data set is not known due toprogressiveLoading
, this method may be used to issue an explicit fetch request to the data source, asking for an accurate row count for the criteria currently applied to this ResultSet. The row count will then be available viagetRowCount()
, and ifapplyRowCountToLength
is true, thelength
of the ResultSet will be updated to reflect the reported value.If the
criteria
for the ResultSet change while a row count fetch is in progress, therowCount
for the resultSet will not be updated. In this case the callback passed to this method will still fire, with the criteriaChanged parameter set totrue
Note the fetch request sent to the dataSource will have
DSRequest.progressiveLoading
explicitly set to false andstartRow:0
andendRow:0
. SeerowCountContext
for full details of the request that will be sent to the dataSource.Smart GWT server side dataSources will process such a request by calculating the row-count (for
serverType:"sql"
, this means issuing a row-count database query), skipping any logic to retrieve actual data, and return a response withprogressiveLoading:false
and an accurateDSResponse.totalRows
.If this ResultSet is backed by a custom dataSource implementation, it is recommended that the dataSource either also returns a response with
progressiveLoading:false
and an accurateDSResponse.totalRows
, or uses theDSResponse.estimatedTotalRows
attribute to indicate an accurate row count for the data set.The fetch issued by this method will be marked as a
background request
.- Parameters:
callback
- Callback to fire when the fetch request completes. To retrieve details of the row-count that was retrieved from the server, use thegetRowCount()
andgetRowCountStatus()
methods.dsRequest
- Custom properties for the row count fetch request- See Also:
-
filterLocalData
public void filterLocalData()Derive the current filtered set of data from the cache of all matching rows.This method is automatically called by
setCriteria()
when criteria have actually changed, as well as in various other situations. You could only need to call this method directly if:- you know that client-side
filtering is enabled (
useClientFiltering
:true) and activeallMatchingRowsCached()
. - you have directly, programmatically modified data within the ResultSet such that it no longer matches the filter criteria
- you want
your modified records to disappear from the list of visible records (that is, those accessible via
get()
)
- you know that client-side
filtering is enabled (
-
findByKey
Attempt to find the record in the resultSet that has a primary key value that matches the passed in parameter value. Only the locally cached data will be searched. Checks only loaded rows and will not trigger a fetch. Returns null if there is no match, data is not loaded, or there is nodataSource
.Note, if you pass a simple value to this method, it will be matched against the first primaryKey field. For DataSources with a composite primary key (multiple primaryKey fields), pass a Criteria instance containing just primaryKey entries.
- Parameters:
keyValue
- primary key value to search for- Returns:
- the record with a matching primary key field, or null if not found
-
getCachedRange
public int[] getCachedRange(int rowNum) Returns the index of the first and last cached row around a given row, or null if the row itself is not cached. The last cached row value is inclusive.- Parameters:
rowNum
- row to check- Returns:
- first and last cached row indices, or null
-
getCombinedCriteria
- Returns:
- combined criteria
-
getCombinedCriteriaAsAdvancedCriteria
- Returns:
- combined criteria
-
getLength
public int getLength()Return the total number of records that match the current filter criteria.This length can only be known, even approximately, when the first results are retrieved from the server. Before then, the ResultSet returns a large length in order to encourage viewers to ask for rows.
ResultSet.lengthIsKnown()
can be called to determine whether an actual length is known.Note that if
progressive loading
is active, the length advertised by the server may not be an accurate total row count for the data set.ResultSet.lengthIsProgressive()
can be called to determine whether this is the case.- Overrides:
getLength
in classRecordList
- Returns:
- number of items in the list
-
getProperty
LikeList.getProperty()
. Checks only loaded rows and will not trigger a fetch.- Overrides:
getProperty
in classRecordList
- Parameters:
property
- name of the property to look for- Returns:
- array of the values of property in each item of this list
-
getRowCount
public int getRowCount()This method retrieves the row-count for this data set. If progressive loading is active, this may differ fromgetLength()
. SeegetRowCountStatus()
for more information.- Returns:
- Current row-count for this grid
- See Also:
-
getRowCountRange
IfgetRowCountStatus()
is "range" this method will return a two element array containing the lower and upper bound for the rowCount. In all other cases it will return a two element array where the first element is the result ofgetRowCount()
and the second element is null- Returns:
- row count lower and upper bound
- See Also:
-
getRowCountStatus
This method indicates whethergetRowCount()
reflects an accurate row-count for this data set. An accurate row count may not currently be available ifprogressiveLoading
is active.See
RowCountStatus
for further details.- Returns:
- Current row-count status for this grid
- See Also:
-
getSort
Return the current sort-specification for this ResultSet as an Array ofSortSpecifier
s.- Returns:
- the list of
SortSpecifier
s currently applied to this ResultSet
-
getValueMap
Get a map of the form{ item[idField] -> item[displayField] }
, for all items in the list. If more than one item has the sameidProperty
, the value for the later item in the list will clobber the value for the earlier item.If this method is called when the
cache is incomplete
, it will trigger fetches, and will return a valueMap reflecting only the currently loaded rows.- Overrides:
getValueMap
in classRecordList
- Parameters:
idField
- Property to use as ID (data value) in the valueMapdisplayField
- Property to use as a display value in the valueMap- Returns:
- valueMap object
- See Also:
-
indexOf
Return the position in the list of the first instance of the specified object.If pos is specified, starts looking after that position.
Returns -1 if not found.
NOTE: ResultSet.indexOf() only inspects the current cache of records, so it is only appropriate for temporary presentation purposes. For example, it would not be appropriate to hold onto a record and attempt to use indexOf() to determine if it had been deleted.
- Parameters:
obj
- object to look for- Returns:
- position of the item, if found, -1 if not found
-
indexOf
- See Also:
-
indexOf
Return the position in the list of the first instance of the specified object.If pos is specified, starts looking after that position.
Returns -1 if not found.
NOTE: ResultSet.indexOf() only inspects the current cache of records, so it is only appropriate for temporary presentation purposes. For example, it would not be appropriate to hold onto a record and attempt to use indexOf() to determine if it had been deleted.
- Parameters:
obj
- object to look forpos
- earliest index to considerendPos
- last index to consider- Returns:
- position of the item, if found, -1 if not found
-
invalidateCache
public void invalidateCache()Manually invalidate this ResultSet's cache.Generally a ResultSet will observe and incorporate updates to the DataSource that provides its records, but when this is not possible,
invalidateCache()
allows manual cache invalidation.invalidateCache()
firesdataChanged()
, which may cause components using this ResultSet to request new data for display, triggering server fetches. -
lengthIsKnown
public boolean lengthIsKnown()Whether the ResultSet knows the length of its data set.When the ResultSet fetches data from the DataSource in response to
getRange()
or similar methods,DSResponse.totalRows
from the fetch lets the ResultSet know the full dataset size.Prior to the completion of the first fetch, (or after
dropping cache
) the ResultSet will not know how many records are available. At this timelengthIsKnown()
will return false, and a call togetLength()
will return an arbitrary, large value.Note: If
progressive loading
is active the reportedDSResponse.totalRows
value may not accurately reflect the true dataset size on the server. In this caselengthIsKnown()
returns true, but thereported length
of the ResultSet may change as additional rows are retrieved from the server. ThelengthIsProgressive()
method will indicate when the resultSet is in this state.- Returns:
- whether length is known
-
lengthIsProgressive
public boolean lengthIsProgressive()Does the length of this ResultSet as returned bygetLength()
reflect thetotalRows
reported by a DataSource withProgressiveLoading
enabled?If true, this row count may not be an accurate reflection of the true size of the data set.
This method relies on the
DSResponse.progressiveLoading
attribute having been set accurately by the server. Note that if the user has scrolled to the end of a progressively loaded data set, orsetFullLength()
has been explicitly called, this method will no longer return true.- Returns:
- true if the length of this ResultSet was derived from a
progressiveLoading:true
dsResponse. - See Also:
-
rangeIsLoaded
public boolean rangeIsLoaded(int startRow, int endRow) Whether the given range of rows has been loaded. Unlike getRange(), will not trigger a server fetch.- Parameters:
startRow
- start position, inclusiveendRow
- end position, exclusive- Returns:
- true if all rows in the given range have been loaded, false if any rows in the range have not been loaded or are still in the process of being loaded
-
resort
public void resort()Forcibly resort this ResultSet by the current list ofSortSpecifier
s. -
rowIsLoaded
public boolean rowIsLoaded(int rowNum) Whether the given row has been loaded.Unlike get(), will not trigger a server fetch.
- Parameters:
rowNum
- row to check- Returns:
- true if the given row has been loaded, false if it has not been loaded or is still in the process of being loaded
-
setFullLength
public void setFullLength(int length) Set the total number of rows available from the server that match the current filter criteria for this ResultSet.This is an advanced feature. One use case for this method would be for a ResultSet populated with
progressive loading
- if application code determines an accurate row count for the current filter criteria it may be applied directly to the ResultSet via this method.- Parameters:
length
- total rows available from the server
-
setSort
public void setSort()Sort this ResultSet by the passed list ofSortSpecifier
s.If the ResultSet is already sorted and this method is called with an identical list of specifiers, this method will no-op. To cause data to be resorted with the same set of specifiers, use
resort()
.To clear an existing sort, pass in explicit null or empty array.
-
sortByProperty
Sort this ResultSet by a property of each record.Sorting is performed on the client for a ResultSet that has a full cache for the current filter criteria. Otherwise, sorting is performed by the server, and changing the sort order will invalidate the cache.
NOTE: normalizers are not supported by ResultSets in "paged" mode, although valueMaps in the DataSource are respected by the SQLDataSource.
- Overrides:
sortByProperty
in classRecordList
- Parameters:
property
- name of the property to sort byup
- true == sort ascending, false == sort descending- Returns:
- this ResultSet
-
sortByProperty
-
sortByProperty
Sort this ResultSet by a property of each record.Sorting is performed on the client for a ResultSet that has a full cache for the current filter criteria. Otherwise, sorting is performed by the server, and changing the sort order will invalidate the cache.
NOTE: normalizers are not supported by ResultSets in "paged" mode, although valueMaps in the DataSource are respected by the SQLDataSource.
- Parameters:
property
- name of the property to sort byup
- true == sort ascending, false == sort descendingnormalizer
- May be specified as a function, with signaturenormalize(item, propertyName, context)
, whereitem
is a pointer to the item in the array,propertyName
is the property by which the array is being sorted, andcontext
is the arbitrary context passed into this method. Normalizer function should return the value normalized for sorting.
May also be specified as a ValueMap which maps property values to sortable values.context
- Callers may pass an arbitrary context into the sort method, which will then be made available to the normalizer function- Returns:
- this ResultSet
-
unsort
public boolean unsort()Clear anysort specifiers
applied to this ResultSet, while maintaining the current order of records. This feature is not supported for all lists. This method returns true if supported.If a
paged resultSet
has a partial cache, the order of records in the local data must always match the order of records as provided by theDataSource
- otherwise the wrong set of records will be returned as new pages of data are fetched (in response to a user scrolling a ListGrid, for example).It's therefore not possible to unsort a paged resultSet with a partial cache and maintain the current order of any loaded records. If this method is called on a resultSet in this state, it will always no-op and return false.
If you need to force a partially loaded ResultSet to discard it's current sort, and explicit call to
setSort(null)
may be used. This will drop the current sort specifiers andinvalidateCache()
.- Returns:
- true == list supports unsorting, false == not supported.
-
usingFilteredData
public boolean usingFilteredData()Determine whether the ResultSet is showing a filtered, proper subset of the cached rows. This happens ifclient filtering
is enabled. Rows may have been loaded from the server when a more restrictive criteria is applied such that filtering could be performed on the client side.This method returns false if data is not loaded yet.
- Returns:
- true if the ResultSet is showing a filtered subset of the cached rows, false otherwise.
- See Also:
-
willFetchData
Will changing the criteria for this resultSet require fetching new data from the server, or can the new criteria be satisfied from data already cached on the client?
SecondtextMatchStyle
parameter determines whether a change of text-match style will require a server fetch - for example if filter is being changed between an exact match (from e.g:ListGrid.fetchData()
) and a substring match (from e.g:ListGrid.filterData()
).
This method can be used to determine whetherListGrid.fetchData()
orListGrid.filterData()
would cause a server side fetch when passed a certain set of criteria.Note that to predict correctly the decision that will be made by filter/fetch, you'll need to pass the same
TextMatchStyle
that will be used by the future filter/fetch. Fetching manually (e.g.ListGrid.fetchData()
) will by default use "exact" while filtering (e.g.ListGrid.filterData()
) will by default use "substring". If the component is configured for autofetch (i.e.ListGrid.autoFetchData
: true), that will useListGrid.autoFetchTextMatchStyle
, which defaults to "substring". If nothing/null is passed for the style, this method assumes you want the style from the last filter/fetch.To determine what
TextMatchStyle
is being used, check the RPC Tab of theSmart GWT Developer Console
and check the relevantDSRequest
.- Parameters:
newCriteria
- new criteria to test.- Returns:
- true if server fetch would be required to satisfy new criteria.
-
willFetchData
Will changing the criteria for this resultSet require fetching new data from the server, or can the new criteria be satisfied from data already cached on the client?
SecondtextMatchStyle
parameter determines whether a change of text-match style will require a server fetch - for example if filter is being changed between an exact match (from e.g:ListGrid.fetchData()
) and a substring match (from e.g:ListGrid.filterData()
).
This method can be used to determine whetherListGrid.fetchData()
orListGrid.filterData()
would cause a server side fetch when passed a certain set of criteria.Note that to predict correctly the decision that will be made by filter/fetch, you'll need to pass the same
TextMatchStyle
that will be used by the future filter/fetch. Fetching manually (e.g.ListGrid.fetchData()
) will by default use "exact" while filtering (e.g.ListGrid.filterData()
) will by default use "substring". If the component is configured for autofetch (i.e.ListGrid.autoFetchData
: true), that will useListGrid.autoFetchTextMatchStyle
, which defaults to "substring". If nothing/null is passed for the style, this method assumes you want the style from the last filter/fetch.To determine what
TextMatchStyle
is being used, check the RPC Tab of theSmart GWT Developer Console
and check the relevantDSRequest
.- Parameters:
newCriteria
- new criteria to test.textMatchStyle
- New text match style. If not passed, assumes textMatchStyle will not be modified.- Returns:
- true if server fetch would be required to satisfy new criteria.
-
asSGWTComponent
Returns the existing SGWT ResultSet, or creates and returns one if none exist, associated with the suppliedJavaScriptObject
. If the supplied object is not a SmartClient ResultSet, a warning will be logged and null returned; otherwise the SGWT ResultSet will be returned.- Parameters:
jsObj
- SmartClient ResultSet whose wrapper is wanted- Returns:
- wrapping SGWT ResultSet or null
-
ensureCreated
Ensures that the underlying SmartClient ResultSet object is created for this ResultSet instance. If the SmartClient object has already been created, then calling this method amounts to a no-op. Otherwise, theisc.ResultSet.create()
function is executed to create the SmartClient ResultSet object wrapped by this instance.This method is required to be called for standalone usage of a ResultSet. In addition, it can only be called after all initial configuration (
dataSource
,allRows
if being used, etc.) has been set.- Throws:
IllegalStateException
- if no dataSource has been set
-
getPaletteDefaults
This method returns a Map of config properties suitable for use as the "defaults" attribute of aPaletteNode
. Use it when you need to work with PaletteNodes indirectly, such when setting upTileRecord
s that will be used in aTilePalette
. Seethe dev tools overview
for examples of how to assemble and acquire a suitable defaults object when you are creating a PaletteNode indirectly -
setInitialSort
Initial multi property sort specification for this ResultSet's data. If a ResultSet is being explicitly created and seeded withsetInitialData(Record[])
, this method may be used to notify the ResultSet that the data is already sorted such that a call toRecordList.setSort(SortSpecifier...)
will not require a new fetch unless additional data beyond the ends of the specified initialData are required.- Parameters:
sortSpecifiers
- Initial sort specification
-
indexOf
Return the position in the list of the first instance of the specified object.If pos is specified, starts looking after that position.
Returns -1 if not found.
NOTE: ResultSet.indexOf() only inspects the current cache of records, so it is only appropriate for temporary presentation purposes. For example, it would not be appropriate to hold onto a record and attempt to use indexOf() to determine if it had been deleted.
- Overrides:
indexOf
in classRecordList
- Parameters:
record
- object to look for- Returns:
- position of the item, if found, -1 if not found
-
indexOf
Return the position in the list of the first instance of the specified object.If pos is specified, starts looking after that position.
Returns -1 if not found.
NOTE: ResultSet.indexOf() only inspects the current cache of records, so it is only appropriate for temporary presentation purposes. For example, it would not be appropriate to hold onto a record and attempt to use indexOf() to determine if it had been deleted.
- Overrides:
indexOf
in classRecordList
- Parameters:
record
- object to look forpos
- earliest index to considerendPos
- last index to consider- Returns:
- position of the item, if found, -1 if not found
-
get
Returns the record at the specified position.All List access methods of the ResultSet have the semantics described in
getRange()
.- Overrides:
get
in classRecordList
- Parameters:
pos
- position of the element to get- Returns:
- whatever's at that position, null if not found
-
getRange
Return the items between position start and end, non-inclusive at the end, possibly containing markers for records that haven't loaded yet.Calling getRange for records that have not yet loaded will trigger an asynchronous fetch. The returned data will contain the
loading marker
as a placeholder for records being fetched. If any rows needed to be fetched,dataArrived()
will fire when they arrive.- Overrides:
getRange
in classRecordList
- Parameters:
start
- start positionend
- end position- Returns:
- subset of the array from start -> end-1
-
getRangeAsRecordList
Return a RecordList with the items between position start and end, non-inclusive at the end.- Parameters:
start
- start positionend
- end position- Returns:
- a RecordList containing the items from start -> end-1
-
getAllVisibleRows
Returns a list of the currently visible data, that is, all rows that match the current criteria, with null entries orloading markers
for rows that are not yet loaded or in the process of loading, respectively.This method will not trigger a fetch to load more records. getAllVisibileRows() will return null if
lengthIsKnown()
is false.Records are returned in a new List but the Records within it are the same instances that the ResultSet is holding onto. Hence it's safe to add or remove records from the List without affecting the ResultSet but modifying the Records themselves is a direct modification of the client-side cache.
- Returns:
- the records in the cache that match the current criteria, possibly null
-
getAllCachedRows
Returns a list of all rows that have been cached. This is potentially a superset of all rows that are available viagetAllVisibleRows()
if the ResultSet is using client-side filtering to display a subset of loaded rows (see theResultSet overview
).If
usingFilteredData()
returns false, this is the same list as would be returned bygetAllVisibleRows()
.This method will not trigger a fetch to load more records. getAllCachedRows() will return null if
lengthIsKnown()
is false.Records are returned in a new List but the Records within it are the same instances that the ResultSet is holding onto. Hence it's safe to add or remove records from the List without affecting the ResultSet but modifying the Records themselves is a direct modification of the client-side cache.
- Returns:
- the records in the cache, possibly null
-
findByKey
Attempt to find the record in the resultSet that has a primary key value that matches the passed in parameter value. Only the locally cached data will be searched. Checks only loaded rows and will not trigger a fetch. Returns null if there is no match, data is not loaded, or there is no'dataSource'
.- Parameters:
keyValue
- primary key value to search for- Returns:
- the record with a matching primary key field, or null if not found
-
dataArrived
public void dataArrived(int startRow, int endRow) Deprecated.This method is not an override point in SmartGWT. UseaddDataArrivedHandler(com.smartgwt.client.data.events.DataArrivedHandler)
instead.Notification fired when data has arrived from the server and has been successfully integrated into the cache.When
dataArrived()
fires, an immediate call togetRange()
with thestartRow
andendRow
passed as arguments will return a List with noloading markers
.- Parameters:
startRow
- starting index of rows that have just loadedendRow
- ending index of rows that have just loaded, non-inclusive
-
findAll
Checks only loaded rows and will not trigger a fetch.- Overrides:
findAll
in classRecordList
- Parameters:
properties
- set of properties and values to match- Returns:
- all matching Records or null if none found
-
findAll
Checks only loaded rows and will not trigger a fetch.- Overrides:
findAll
in classRecordList
- Parameters:
propertyName
- property to matchvalue
- value to compare against (if propertyName is a string)- Returns:
- all matching Objects or null if none found
-
findAll
Checks only loaded rows and will not trigger a fetch.- Overrides:
findAll
in classRecordList
- Parameters:
propertyName
- property to matchvalue
- value to compare against (if propertyName is a string)- Returns:
- all matching Objects or null if none found
-
findAll
Checks only loaded rows and will not trigger a fetch.Note: JavaScript has no long type, so the long value becomes a JavaScript Number, which has a lesser range than Java long. The range for integer numbers in Javascript is [-9007199254740992,9007199254740992] or [-Math.pow(2,53),Math.pow(2,53)].
- Overrides:
findAll
in classRecordList
- Parameters:
propertyName
- property to matchvalue
- value to compare against (if propertyName is a string)- Returns:
- all matching Objects or null if none found
-
findAll
Checks only loaded rows and will not trigger a fetch.- Overrides:
findAll
in classRecordList
- Parameters:
propertyName
- property to matchvalue
- value to compare against (if propertyName is a string)- Returns:
- all matching Objects or null if none found
-
findAll
Checks only loaded rows and will not trigger a fetch.- Overrides:
findAll
in classRecordList
- Parameters:
propertyName
- property to matchvalue
- value to compare against (if propertyName is a string)- Returns:
- all matching Objects or null if none found
-
findAll
Find all objects where property == value in the object.- Overrides:
findAll
in classRecordList
- Parameters:
propertyName
- property to matchvalue
- value to compare against (if propertyName is a string)- Returns:
- all matching Objects or null if none found
-
findAll
Filters all objects according to the AdvancedCriteria passed and will not trigger a fetch.- Overrides:
findAll
in classRecordList
- Parameters:
adCriteria
- AdvancedCriteria to use to filter results- Returns:
- all matching Objects or null if none found
-
find
Checks only loaded rows and will not trigger a fetch.- Parameters:
properties
- set of properties and values to match- Returns:
- first matching object or null if not found
-
find
LikeRecordList.find(java.lang.String, java.lang.Object)
. Checks only loaded rows and will not trigger a fetch.- Overrides:
find
in classRecordList
- Parameters:
propertyName
- property to matchvalue
- value to compare against (if propertyName is a string)- Returns:
- first matching object or null if not found
-
findIndex
LikeRecordList.findIndex(java.util.Map)
. Checks only loaded rows and will not trigger a fetch.- Overrides:
findIndex
in classRecordList
- Parameters:
properties
- set of properties and values to match- Returns:
- index of the first matching Record or -1 if not found
-
findIndex
LikeRecordList.findIndex(java.util.Map)
. Checks only loaded rows and will not trigger a fetch.- Overrides:
findIndex
in classRecordList
- Parameters:
propertyName
- property to matchvalue
- value to compare against- Returns:
- index of the first matching Record or -1 if not found
-
findIndex
LikeRecordList.findIndex(java.util.Map)
. Checks only loaded rows and will not trigger a fetch.- Overrides:
findIndex
in classRecordList
- Parameters:
propertyName
- property to matchvalue
- value to compare against- Returns:
- index of the first matching Record or -1 if not found
-
findIndex
LikeRecordList.findIndex(java.util.Map)
. Checks only loaded rows and will not trigger a fetch.Note: JavaScript has no long type, so the long value becomes a JavaScript Number, which has a lesser range than Java long. The range for integer numbers in Javascript is [-9007199254740992,9007199254740992] or [-Math.pow(2,53),Math.pow(2,53)].
- Overrides:
findIndex
in classRecordList
- Parameters:
propertyName
- property to matchvalue
- value to compare against- Returns:
- index of the first matching Record or -1 if not found
-
findIndex
LikeRecordList.findIndex(java.util.Map)
. Checks only loaded rows and will not trigger a fetch.- Overrides:
findIndex
in classRecordList
- Parameters:
propertyName
- property to matchvalue
- value to compare against- Returns:
- index of the first matching Record or -1 if not found
-
findIndex
LikeRecordList.findIndex(java.util.Map)
. Checks only loaded rows and will not trigger a fetch.- Overrides:
findIndex
in classRecordList
- Parameters:
propertyName
- property to matchvalue
- value to compare against- Returns:
- index of the first matching Record or -1 if not found
-
findIndex
LikeRecordList.findIndex(java.util.Map)
. Checks only loaded rows and will not trigger a fetch.- Overrides:
findIndex
in classRecordList
- Parameters:
propertyName
- property to matchvalue
- value to compare against- Returns:
- index of the first matching Record or -1 if not found
-
findNextIndex
LikeRecordList.findNextIndex(int, java.lang.String)
. Checks only loaded rows and will not trigger a fetch.- Overrides:
findNextIndex
in classRecordList
- Parameters:
startIndex
- first index to considerproperties
- set of properties and values to match- Returns:
- index of the first matching Record or -1 if not found
-
findNextIndex
LikeRecordList.findNextIndex(int, java.lang.String)
. Checks only loaded rows and will not trigger a fetch.- Overrides:
findNextIndex
in classRecordList
- Parameters:
startIndex
- first index to considerpropertyName
- property to matchvalue
- value to compare against (if propertyName is a string)endIndex
- last index to consider- Returns:
- index of the first matching Record or -1 if not found
-
findNextIndex
LikeRecordList.findNextIndex(int, java.lang.String)
. Checks only loaded rows and will not trigger a fetch.- Overrides:
findNextIndex
in classRecordList
- Parameters:
startIndex
- first index to considerpropertyName
- property to matchvalue
- value to compare against (if propertyName is a string)endIndex
- last index to consider- Returns:
- index of the first matching Record or -1 if not found
-
findNextIndex
LikeRecordList.findNextIndex(int, java.lang.String)
. Checks only loaded rows and will not trigger a fetch.Note: JavaScript has no long type, so the long value becomes a JavaScript Number, which has a lesser range than Java long. The range for integer numbers in Javascript is [-9007199254740992,9007199254740992] or [-Math.pow(2,53),Math.pow(2,53)].
- Overrides:
findNextIndex
in classRecordList
- Parameters:
startIndex
- first index to considerpropertyName
- property to matchvalue
- value to compare against (if propertyName is a string)endIndex
- last index to consider- Returns:
- index of the first matching Record or -1 if not found
-
findNextIndex
LikeRecordList.findNextIndex(int, java.lang.String)
. Checks only loaded rows and will not trigger a fetch.- Overrides:
findNextIndex
in classRecordList
- Parameters:
startIndex
- first index to considerpropertyName
- property to matchvalue
- value to compare against (if propertyName is a string)endIndex
- last index to consider- Returns:
- index of the first matching Record or -1 if not found
-
findNextIndex
LikeRecordList.findNextIndex(int, java.lang.String)
. Checks only loaded rows and will not trigger a fetch.- Overrides:
findNextIndex
in classRecordList
- Parameters:
startIndex
- first index to considerpropertyName
- property to matchvalue
- value to compare against (if propertyName is a string)endIndex
- last index to consider- Returns:
- index of the first matching Record or -1 if not found
-
findNextIndex
LikeRecordList.findNextIndex(int, java.lang.String)
. Checks only loaded rows and will not trigger a fetch.- Overrides:
findNextIndex
in classRecordList
- Parameters:
startIndex
- first index to considerpropertyName
- property to matchvalue
- value to compare against (if propertyName is a string)endIndex
- last index to consider- Returns:
- index of the first matching Record or -1 if not found
-
isResultSet
-
getLoadingMarker
Returns the singleton marker object that is used as a placeholder for records that are being loaded from the server.- Returns:
- the loading marker
-