Announcement

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

    Bug: ListGrid issues fetch even though setAutoFetchData(false)

    Hi Isomorphic,

    please see this minimal testcase (based on builtInDS) showing a unnecessary fetch even though setAutoFetchData(false) is set.
    The fetch results in a DS Console warning "13:05:05.810:XRP0:WARN:The ResultSet's cache was invalidated while the following request was outstanding".

    Tested with v9.1p_2014-06-29 in FF26 DevMode.

    BuiltInDS.java
    Code:
    package com.smartgwt.sample.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.core.KeyIdentifier;
    import com.smartgwt.client.data.AdvancedCriteria;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.data.SortSpecifier;
    import com.smartgwt.client.rpc.RPCManager;
    import com.smartgwt.client.types.OperatorId;
    import com.smartgwt.client.types.SortDirection;
    import com.smartgwt.client.util.PageKeyHandler;
    import com.smartgwt.client.util.Page;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class BuiltInDS implements EntryPoint {
    	private VLayout vL;
    	private ListGrid boundList;
    	private ListGrid boundList2;
    
    	public void onModuleLoad() {
    		final DataSource animals = DataSource.get("animals");
    		KeyIdentifier debugKey = new KeyIdentifier();
    		debugKey.setCtrlKey(true);
    		debugKey.setKeyName("D");
    
    		Page.registerKey(debugKey, new PageKeyHandler() {
    			public void execute(String keyName) {
    				SC.showConsole();
    			}
    		});
    		vL = new VLayout(10);
    
    		boundList = new ListGrid(animals) {
    			{
    				setHeight(400);
    				setWidth(800);
    
    				setAutoFetchData(false);
    				setInitialSort(new SortSpecifier[] { new SortSpecifier("scientificName", SortDirection.ASCENDING) });
    
    				ListGridField commonName = new ListGridField("commonName");
    				setFields(commonName);
    			}
    		};
    
    		boundList2 = new ListGrid(animals) {
    			{
    				setHeight(400);
    				setWidth(800);
    
    				setAutoFetchData(false);
    				setSort(new SortSpecifier[] { new SortSpecifier("scientificName", SortDirection.DESCENDING) });
    
    				// This has a displayField of "commonName" in the ds.xml file!
    				ListGridField scientificName = new ListGridField("scientificName");
    				setFields(scientificName);
    			}
    		};
    
    		vL.setMembers(boundList, boundList2);
    
    		RPCManager.startQueue();
    		boundList.fetchData(new AdvancedCriteria("lifeSpan", OperatorId.LESS_THAN, 50));
    		boundList2.fetchData(new AdvancedCriteria("lifeSpan", OperatorId.GREATER_OR_EQUAL, 50));
    		RPCManager.sendQueue();
    
    		vL.draw();
    	}
    }
    Change to animals.ds.xml:
    Code:
    <field name="scientificName"  title="Scientific Name"    type="text"  primaryKey="true"  required="true" displayField="commonName" />

    Interesting observation 1:
    In RPC-Tab of the Dev Console, it is for the unnecessary fetch:
    sortBy:[
    "-commonName"
    ]

    while it is
    sortBy:[
    "-scientificName"
    ]

    for the queued fetch.

    Interesting observation 2:
    If you remove "setFields(scientificName);" (so no setFields() for that ListGrid), the bug is gone.

    Interesting observation 3:
    If you move "vL.draw();" above the RPC-Manager-block, the bug is gone.

    Unfortunately I don't have these options in my app.

    Best regards,
    Blama

    #2
    It sounds like the fetch is attempting to pick up the display field value in order to build a mapping from data to display values. You should be able to disable this behavior via setAutoFetchDisplayMap(false).

    If there's something deeper going on here, let us know and we'll take a look

    Thanks
    Isomorphic Software

    Comment


      #3
      Hi Isomorphic,

      setting setAutoFetchDisplayMap(false); on both ListGrids does not change anything. I think this was to expect, otherwise the observations 2&3 from the initial post would not make any sense.

      Best regards,
      Blama

      Comment


        #4
        Hi Isomorphic,

        can you reproduce the behaviour with the provided testcase?

        Thanks,
        Blama

        Comment


          #5
          We are indeed reproducing this issue and it looks like we have the cause. Expect a fix in the next couple of days

          Regards
          Isomorphic Software

          Comment


            #6
            We've now made a change to address this issue. Please try the next nightly build, dated July 10 or above

            Regards
            Isomorphic Software

            Comment


              #7
              Hi Isomorphic,

              your change fixed this for me.

              Thank you & Best regards,
              Blama

              Comment


                #8
                Just saw this, but I'm not up to date. Was this also fixed in the 4.1p branch?

                Comment


                  #9
                  Hi beckyo,

                  yes, it was. I'm on 4.1p as well.

                  Best regards,
                  Blama

                  Comment


                    #10
                    Thank you!

                    Comment

                    Working...
                    X