Class JsonReaderResponse<T>
java.lang.Object
ch.tocco.nice2.netui.api.dwr.extstore.JsonReaderResponse<T>
- Type Parameters:
T
- Type of Objects that will be converted to Ext.data.Records by the client-side Ext.data.DataReader.
Creates a response that can be consumed by an Ext.data.JsonReader.
The client-side Ext.data.JsonReader must have the "root" property set to "objectsToConvertToRecords".
Note: Ext documentation often uses "rows" for this property, but "objectsToConvertToRecords" is more clear.
Example Ext.data.JsonReader configuration:
{
root : 'objectsToConvertToRecords'
}
If the parameterized type has two properties "field1" and "field2", then when an instance of this class is read by the client,
it will look like:
{
objectsToConvertToRecords : [
{
field1 : 'value',
field2 : 'value',
}, {
field1 : 'value',
field2 : 'value',
}
],
success : true
}
-
Constructor Summary
ConstructorDescriptionCreates an unsuccess
ful JsonReaderResponse with nullobjectsToConvertToRecords
.JsonReaderResponse
(List<T> objectsToConvertToRecords) Creates asuccess
ful JsonReaderResponse with the providedobjectsToConvertToRecords
.JsonReaderResponse
(List<T> objectsToConvertToRecords, Map<String, Object> properties, @Nullable Integer total) -
Method Summary
Modifier and TypeMethodDescriptionObject[]
boolean
@Nullable Integer
getTotal()
void
setMetaData
(MetaData metaData) Adds the meta data object to the json reader response.
-
Constructor Details
-
JsonReaderResponse
Creates asuccess
ful JsonReaderResponse with the providedobjectsToConvertToRecords
.- Parameters:
objectsToConvertToRecords
- items
-
JsonReaderResponse
-
JsonReaderResponse
-
JsonReaderResponse
public JsonReaderResponse()Creates an unsuccess
ful JsonReaderResponse with nullobjectsToConvertToRecords
. This signals the case where the client established a connection with the server, but the server couldn't fulfill it (e.g., user doesn't have proper user credentials).
-
-
Method Details
-
setMetaData
Adds the meta data object to the json reader response. Adding meta data can be used to reconfigure the column model dynamically.- Parameters:
metaData
- the meta data object.
-
getSuccess
public boolean getSuccess() -
getObjectsToConvertToRecords
-
getProperties
-
getMetaData
-
getTotal
-