Closed GoogleCodeExporter closed 9 years ago
Use fetchData(Criteria, DSCallback) passing the criteria of records to be
fetched or null if not filtering is required.
Register a DSCallback and call DSResponse.getData() to get an array of Records.
Original comment by sanjiv.j...@gmail.com
on 9 May 2009 at 12:45
what about more specific problems?
we have two data sources (nr 1): the first has groups with an id and a name. the
second (nr 2) holds data with a reference (id) to the groups. we try to display
the
data in a list grid and group the data by the group id and display the
groupname as
group title.
we set the datasource (nr 2) as datasource for the list grid and grouped it.
then we
set a groupValueFunction for the getting the name of the groups from the first
data
source (nr 1). we fetched it, passing the groupid as a criteria and got the
requested
data in a callback function, we triggered.
now we have to wait for the callback function to return the requested value.
But in
the meantime returned an empty value.
example:
ListGridField group = new ListGridField("groupid", "group", 250);
userAgentGroup.setGroupValueFunction(new GroupValueFunction () {
String name = null;
@Override
public Object getGroupValue(Object value, ListGridRecord record,
ListGridField field, String fieldName, ListGrid grid) {
final int groupID = (Integer) value;
Criteria cr = new Criteria();
cr.addCriteria("id", groupID);
userAgentGroups.fetchData(cr, new DSCallback() {
@Override
public void execute(DSResponse response, Object rawData,
DSRequest request) {
Record[] test = response.getData();
for ( int i= 0; i < test.length; i++) {
name = test[i].getAttributeAsString("name");
}
}
});
return name; // name is empty, at this time !
}
});
Is there an other solution or wouldn´t it be easier to acces the record sets
by a
function the data source provides?
Original comment by m.mil...@newelements.de
on 11 Aug 2009 at 5:21
This is a situation that you need to come up with a solution for based on your
application requirements since RPC calls are asynchronous. If the number of
groups
are limited, you can try preloading them and keeping a Map of the groupID -->
name
around.
Original comment by sanjiv.j...@gmail.com
on 11 Aug 2009 at 5:27
Original issue reported on code.google.com by
ricard.i...@gmail.com
on 2 Feb 2009 at 10:33