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

How ResultSet will recognize change in Criteria

$
0
0
I wanted to know how ResultSet will figure out if there is a change in the criteria.

When i am creating a new instance of ResultSet with some data and setting it to the ListGrid ,the Listgrid always assumes that there is a change in the criteria and the existing data is wiped out by call to InvalidateCache and new data is cached from position 0.

Is there anyway that i can hint ResultSet to insert the data received from the server to cache from a specified position (eg : startRow)

To Elaborate on this,

Following logs

Code:

1:46:20.550:XRP1:INFO:ResultSet:isc_BillingGroupParticipationWizardPane_24$1_0 (created by: undefined):creating auto-operation for operationType: fetch
01:46:20.555:XRP1:INFO:ResultSet:isc_BillingGroupParticipationWizardPane_24$1_0 (created by: undefined):setCriteria: filter criteria changed, invalidating cache
01:46:20.555:XRP1:INFO:ResultSet:isc_BillingGroupParticipationWizardPane_24$1_0 (created by: undefined):Invalidating cache
01:46:20.555:XRP1:DEBUG:ResultSet:isc_BillingGroupParticipationWizardPane_24$1_0 (created by: undefined):integrating 75 rows into cache at position 0
01:46:20.555:XRP1:DEBUG:ResultSet:isc_BillingGroupParticipationWizardPane_24$1_0 (created by: undefined):full length set to: 6000
01:46:20.936:RDQ6:DEBUG:ResultSet:isc_BillingGroupParticipationWizardPane_24$1_0 (created by: undefined):getRange(0, 16) satisfied from cache

Above log gives the information regarding the dropping of cache on change of criteria.However i am not making any criteria changes as you can see that in the following code

Code:

ResultSet resultset = new ResultSet();
resultset.setDataSource(ds);
resultset.setFetchMode(FetchMode.PAGED);
resultset.setUpdateCacheFromRequest(false);
resultset.setInitialLength(response.getTotalRows());
Record[] responseData = response.getData();
Record[] initialData = new Record[response.getEndRow()];
if(dataRecords == null){
dataRecords= new ArrayList<Record>();
}
System.out.println("Data records "+dataRecords.size() + "Start row "+request.getStartRow());
                                                                        if(dataRecords.size() > 0 && dataRecords.size() < request.getStartRow() ){
                                                                                int a=0;
                                                                                for(;a<dataRecords.size();a++){
                                                                                        initialData[a]=dataRecords.get(a);
                                                                                }
                                                                                GWT.log("DR>SR2:"+a);
                                                                                for(;a<request.getStartRow();a++){
                                                                                        initialData[a]=null;
                                                                                }
                                                                                GWT.log("DR>SR4:"+a);
                                                                                for(;a<request.getEndRow();a++){
                                                                                        initialData[a]=responseData[a-request.getStartRow()];
                                                                                }
                                                                        }else{
                                                                                if(dataRecords.size() ==0){
                                                                                        for(int i=0;i<request.getEndRow();i++){
                                                                                                initialData[i]=responseData[i];
                                                                                                dataRecords.add(i, initialData[i]);
                                                                                        }
                                                                                }else{
                                                                                        int a=0;
                                                                                        for(;a<dataRecords.size();a++){
                                                                                                initialData[a]=dataRecords.get(a);
                                                                                        }
                                                                                        GWT.log("DR>SR:"+a);
                                                                                        for(;a<request.getEndRow();a++){
                                                                                                initialData[a]=responseData[a-request.getStartRow()];
                                                                                                dataRecords.add(a, initialData[a]);
                                                                                        }
                                                                                }
                                                                               
                                                                        }
                                                                        resultset.setInitialData(initialData);
                                                                        unassignedGrid.setData(resultset);
                                                                        unassignedGrid.scrollToRow(request.getStartRow());




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

Viewing all articles
Browse latest Browse all 4756

Trending Articles