Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Manually creating new result set is invalidating the current cache

$
0
0
Be sure your post includes:

SmartClient Version: SC_SNAPSHOT-2011-12-05/LGPL Development Only (built 2011-12-05)

FireFox 25.0

Following is my usecase,

I am trying to manually set the data as recordList from server to the Listgrid via following code.

Code:

//note : response is from fetchData call
ResultSet resultset = new ResultSet();
resultset.setDataSource(ds);
//resultset.setCriteria(criteria);
resultset.setFetchMode(FetchMode.PAGED);
resultset.setInitialLength(response.getTotalRows());

Record[] responseData = response.getData();
Record[] initialData = new Record[response.getEndRow()+1];
for (int i = 0; i <= response.getEndRow() ; i++) {
GWT.log("i = "+i+" StartRow = "+response.getStartRow());
if (i < response.getStartRow()){
Record record = new Record();
record.setAttribute("id", Random.nextInt());
record.setAttribute("name", "Name"+Random.nextInt());
initialData[i] = record; //doing this for testing if i scroll past to  // arbitary some records are filled for the rows above
//is there any solution for this ??
}else{                                                                                if(i- response.getStartRow() < responseData.length)
initialData[i] = responseData[i- response.getStartRow()];
}
}
resultset.setInitialData(initialData);
grid.setData(resultset);

I will be calling fetchData for every 3 seconds. If the data contains exception then the above code will not be executed and be ignored else it will be executed.

Initially 0-75 records are loaded into the cache.
when i scroll beyond 75,

1.When scroll past the 75th records the request is made for
75-150 records are loaded into cache .
but before that the current cache is invalidated by the resultset.(you can see the bold log statement)

2.Also one more issue is the 150 records from server are cached at the position 0 always. I want the new records (75-150) to be cached /inserted at 75th position.

Logs:

Request :

First 0-75 invalid data (ignored)
Code:

fields: {_operationType: "fetch",
_startRow: 0,
_endRow: 75,
_textMatchStyle: "exact",
_dataSource: "unassignedDS1396940462248",
isc_metaDataPrefix: "_",
isc_dataFormat: "xml"}

Response

<response><status>0</status><startRow>0</startRow><endRow>0</endRow><messageTypeID>-9004</messageTypeID><asyncQueryID>015dec555609b719cd655beaaba0</asyncQueryID><message>Processing data please wait...</message><totalRows>0</totalRows></response>"


2:41:32.531:XRP4:INFO:ResultSet:isc_ResultSet_6 (created by: undefined):Received 0 records from server
12:41:32.532:XRP4:DEBUG:ResultSet:isc_ResultSet_6 (created by: undefined):full length set to: 0
12:41:32.532:XRP4:DEBUG:ResultSet:isc_ResultSet_6 (created by: undefined):integrating 0 rows into cache at position 0
12:41:32.532:XRP4:INFO:ResultSet:isc_ResultSet_6 (created by: undefined):cached 0 rows, from 0 to 0 (0 total rows, 0 cached)
12:41:32.532:XRP4:INFO:ResultSet:isc_ResultSet_6 (created by: undefined):Cache for entire DataSource complete

0-75 call now for valid data
Code:

Request

 {_operationType: "fetch",
_startRow: 0,
_endRow: 75,
_textMatchStyle: "exact",
_dataSource: "unassignedDS1396940500911",
isc_metaDataPrefix: "_",
isc_dataFormat: "xml"}


Other informational Logs

: undefined):creating auto-operation for operationType: fetch
12:32:12.282:XRP5:INFO:ResultSet:isc_ResultSet_6 (created by: undefined):setCriteria: filter criteria changed, invalidating cache
12:32:12.283:XRP5:INFO:ResultSet:isc_ResultSet_6 (created by: undefined):Invalidating cache
12:32:12.283:XRP5:DEBUG:ResultSet:isc_ResultSet_6 (created by: undefined):integrating 75 rows into cache at position 0
12:32:12.283:XRP5:DEBUG:ResultSet:isc_ResultSet_6 (created by: undefined):full length set to: 6000
12:32:12.400:RDQ8:DEBUG:ResultSet:isc_ResultSet_6 (created by: undefined):getRange(0, 16) satisfied from cache


Viewing all articles
Browse latest Browse all 4756

Trending Articles