Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Browser cached data not sorted

    Hi Team,

    We are currently using:-
    BuildDate Wed Mar 05 15:52:00 IST 2014
    Version 4.1p
    SCVersionNumber v9.1p_2014-03-05

    My problem is that I have configured datasources using XML file.For one table i have enabled browser level cache.
    Now when i send my first DB hit , the call i get at server has no where clause or sort by clause as i see in the query(which is understandable as it needs to cache whole table on browser).
    But for subsequent hits or even my first hit my sorting is not working at all.
    My expectation is - That Whole data will be captured on the browser in first hit but only the data that satisfies my where clauses and sorting is returned to application(both in first hit and subsequent hits).Here where clauses are working as expected(although no way to ensure that) but sorting not working.

    Attaching the DS.XMl for reference
    Attached Files

    #2
    Sorry, but we can't make any sense of what you said.

    cacheAllData="true" means that the full data is loaded into the browser, with no attempt to ask the server to sort. Data is then sorted and filtered client-side when components request data from the DataSource.

    If you think you are experiencing a framework bug in this area, try creating a minimal, ready-to-run test case demonstrating the issue (please also make a second attempt to explain what you expected and why along with any such test case).

    Comment


      #3
      "cacheAllData="true" means that the full data is loaded into the browser, with no attempt to ask the server to sort. Data is then sorted and filtered client-side when components request data from the DataSource. "

      Exactly the issue that this is what is expected but is not happening in case of sorting(filtering is working as expected.)

      I have attached the sample code, ds file without caching and 2 pngs showing difference in results when we add or remove the caching setting from ds.xml.

      So i have explained "what" the issue is in second attempt and as to answer the "why" - it is the business need.
      Attached Files

      Comment


        #4
        We've reminded you so many times of the basic items that need to be posted every time with an issue that we're sure there's no need to be reminded again. We'll watch this thread for updates.

        Comment


          #5
          We are currently using:-
          BuildDate Wed Mar 05 15:52:00 IST 2014
          Version 4.1p
          SCVersionNumber v9.1p_2014-03-05

          As you said "Data is then sorted and filtered client-side when components request data from the DataSource. "


          But when i m using cacheAllData="true" i am not getting data as sorted .

          Kindly see the below snippet

          Code:
          package com.smartgwt.test.client;
          
          import java.util.HashMap;
          import java.util.Map;
          
          import com.google.gwt.core.client.EntryPoint;
          import com.google.gwt.user.client.ui.CheckBox;
          import com.smartgwt.client.data.AdvancedCriteria;
          import com.smartgwt.client.data.Criterion;
          import com.smartgwt.client.data.DSCallback;
          import com.smartgwt.client.data.DSRequest;
          import com.smartgwt.client.data.DSResponse;
          import com.smartgwt.client.data.DataSource;
          import com.smartgwt.client.data.Record;
          import com.smartgwt.client.data.SortSpecifier;
          import com.smartgwt.client.types.OperatorId;
          import com.smartgwt.client.types.Overflow;
          import com.smartgwt.client.types.SortDirection;
          import com.smartgwt.client.types.Visibility;
          import com.smartgwt.client.util.SC;
          import com.smartgwt.client.widgets.layout.HLayout;
          import com.smartgwt.client.widgets.layout.VLayout;
          
          public class SmartGWTProject implements EntryPoint {
          
              Map<Integer, SortSpecifier[]> sortSpecifiers = new HashMap<Integer, SortSpecifier[]>();
          
              @Override
              public void onModuleLoad() {
                  sortSpecifiers.put(0, new SortSpecifier[] { new SortSpecifier("FEATURE_SEQUENCE", SortDirection.ASCENDING) });
                  sortSpecifiers.put(1, new SortSpecifier[] { new SortSpecifier("THEME_SEQUENCE", SortDirection.ASCENDING) });
                  sortSpecifiers.put(2, new SortSpecifier[] { new SortSpecifier("DATA_VISUAL_SEQUENCE", SortDirection.ASCENDING) });
          
                  VLayout vhl = new VLayout();
                  vhl.setHeight(400);
                  vhl.setWidth(600);
          
                  DataSource girdLayoutDataSource = DataSource.get("wm_view_grid_layout");
                  AdvancedCriteria criteria = new AdvancedCriteria("IS_DEFAULT", OperatorId.EQUALS, "1");
                  criteria.addCriteria(new Criterion("IS_MULTI_METRIC_GRID", OperatorId.EQUALS, "N"));
                  criteria.addCriteria(new Criterion("IS_HIDDEN", OperatorId.EQUALS, "N"));
                  DSRequest requestProperties = new DSRequest();
                  requestProperties.setOutputs("FEATURE_NAME");
                  requestProperties.setSortBy(sortSpecifiers.get(0));
          
                  final HLayout layout = new HLayout();
                  getCheckBoxForm(girdLayoutDataSource, criteria, requestProperties, layout, "FEATURE_NAME");
          
                  AdvancedCriteria criteria1 = new AdvancedCriteria("IS_DEFAULT", OperatorId.EQUALS, "1");
                  criteria1.addCriteria(new Criterion("IS_MULTI_METRIC_GRID", OperatorId.EQUALS, "N"));
                  criteria1.addCriteria(new Criterion("IS_HIDDEN", OperatorId.EQUALS, "N"));
          
                  DSRequest requestProperties1 = new DSRequest();
                  requestProperties1.setOutputs("THEME_NAME");
                  requestProperties1.setSortBy(sortSpecifiers.get(1));
                  final HLayout layoutnew = new HLayout();
                  getCheckBoxForm(girdLayoutDataSource, criteria1, requestProperties1, layoutnew, "THEME_NAME");
                  vhl.setVisibility(Visibility.VISIBLE);
                  vhl.setOverflow(Overflow.AUTO);
                  vhl.addMember(layout);
                  vhl.addMember(layoutnew);
                  vhl.draw();
              }
          
              private void getCheckBoxForm(DataSource girdLayout, AdvancedCriteria criteria, DSRequest requestProperties, final HLayout layout, final String fieldName) {
                  layout.setBorder("2px solid red");
                  layout.setHeight100();
                  layout.setWidth100();
                  layout.setVisibility(Visibility.VISIBLE);
                  layout.setOverflow(Overflow.AUTO);
                  girdLayout.fetchData(criteria, new DSCallback() {
          
                      @Override
                      public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) {
                          Record[] result = dsResponse.getDataAsRecordList().toArray();
                          if (result.length == 0)
                              SC.say("No Data");
                          else {
                              for (Record eachRow : result) {
                                  CheckBox box = new CheckBox(eachRow.getAttribute(fieldName));
                                  layout.addMember(box);
                              }
                          }
          
                      }
                  }, requestProperties);
              }
          
          }

          The code snippet for wm_view_grid_layout.ds.xml file :-
          Code:
          <DataSource ID="wm_view_grid_layout" serverType="sql" tableName="wm_view_grid_layout" cacheAllData="true" cacheMaxAge="600">
          	<fields>
          		
          		<field name="FEATURE_SEQUENCE" type="integer" />
          		<field name="FEATURE_NAME" type="text" length="255" />
          		
          		<field name="THEME_SEQUENCE" type="integer" />
          		<field name="THEME_NAME" type="text" length="255" />
          		
          		<field name="DATA_VISUAL_SEQUENCE" type="integer" />
          		<field name="IS_DEFAULT" type="integer" />
          		
          		<field name="IS_MULTI_METRIC_GRID" type="text" />
          		<field name="IS_HIDDEN" type="text" length="10" />
          		
          	</fields>
          </DataSource>
          This is not working for me .

          Please let me know what else is missing.

          Comment


            #6
            We request the same things every time. Every time you post you have to delete text that lists the things that are required.

            You have forgotten to include the actual data being returned from your server (RPC tab contents), the Developer Console log, and the server log (for the case where you do not set cacheAllData="true").

            Comment


              #7
              Sorry for the inconvenience but we have never added these things in our queries so far and hence all the confusion.

              All the content attached is correspnding to the case when cacheAllData="true"
              1) image -rpc request console (developer console) shows the order and number of requests
              2) request0 ,request1,request2 contains the contents of the requests(numbering as in the order in the image)
              3) logs file

              Please let me know if anything missing or format is not correct.

              Was unable to attach response from developer console due to size limit.
              Attached Files
              Last edited by mchoudhary; 13 Jan 2015, 05:26.

              Comment


                #8
                Team,
                Can we please have the response.

                Comment


                  #9
                  We're looking into it and will update here shortly.

                  Comment


                    #10
                    sure. thanks .

                    Comment


                      #11
                      You have still forgotten to include the actual data being returned from your server - as we said, this is the RPC tab *contents*. You have provided a picture of the RPC tab that lists the requests, but we need the actual data being returned.

                      Also, test-cases are supposed to be standalone samples that we can just drop into a project and run to see the problem. This means no reliance on a server at all, unless the issue is server-specific - in this case, the issue is clearly around client-side sorting.

                      So, the DataSource in your test-case should be a clientOnly one, and the test-case should also provide data for it.

                      Comment

                      Working...
                      X