Announcement

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

    Bug: Current sorting not watched in DSRequest for invalidateCache in grouped ListGrid

    Hi Isomorphic,

    please see this code (BuiltInDS-based, v9.1p_2014-07-24, FF26 Dev mode).

    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.DataSource;
    import com.smartgwt.client.data.SortSpecifier;
    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.IButton;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    /**
     * Entry point classes define <code>onModuleLoad()</code>.
     */
    public class BuiltInDS implements EntryPoint {
    	private ListGrid boundList;
    	private IButton btn;
    
    	public void onModuleLoad() {
    		KeyIdentifier debugKey = new KeyIdentifier();
    		debugKey.setCtrlKey(true);
    		debugKey.setKeyName("D");
    
    		Page.registerKey(debugKey, new PageKeyHandler() {
    			public void execute(String keyName) {
    				SC.showConsole();
    			}
    		});
    
    		boundList = new ListGrid(DataSource.get("animals"));
    		boundList.setWidth(1200);
    		boundList.setHeight(600);
    		boundList.setCanMultiSort(true);
    		boundList.setCanSort(true);
    		boundList.setShowFilterEditor(true);
    		boundList.setAutoFetchData(false);
    
    		ListGridField commonName = new ListGridField("commonName");
    		ListGridField scientificName = new ListGridField("scientificName");
    		ListGridField lifeSpan = new ListGridField("lifeSpan");
    		lifeSpan.setTitle("Our title");
    		lifeSpan.setSortByDisplayField(true);
    		// ListGridField status = new ListGridField("status");
    		ListGridField diet = new ListGridField("diet");
    		ListGridField information = new ListGridField("information");
    
    		boundList.setFields(commonName, scientificName, lifeSpan, diet, information);
    		boundList.setSort(new SortSpecifier("lifeSpan", SortDirection.ASCENDING));
    		boundList.fetchData();
    
    		btn = new IButton("invalidateCache()");
    		btn.addClickHandler(new ClickHandler() {
    			@Override
    			public void onClick(ClickEvent event) {
    				boundList.invalidateCache();
    			}
    		});
    
    		VLayout vLayout = new VLayout(10);
    		vLayout.setMembers(boundList, btn);
    		vLayout.draw();
    	}
    }
    animals.ds.xml
    Code:
    <DataSource
        ID="animals"
    	serverType="sql"
    	tableName="animals"
        testFileName="animals.data.xml"
    >
        <fields>
            <field name="commonName"      title="Animal"             type="text"/>
            <field name="scientificName"  title="Scientific Name"    type="text"  primaryKey="true"  required="true"/>
            <field name="lifeSpan"        title="LIFESPAN BUT WE SHOW STATUS"  displayField="status"         type="integer"/>
            <field name="status"          title="Endangered Status"  type="text">
                <valueMap>
                    <value>Threatened</value>
                    <value>Endangered</value>
                    <value>Not Endangered</value>
                    <value>Not currently listed</value>
                    <value>May become threatened</value>
                    <value>Protected</value>
                </valueMap>
            </field>
            <field name="diet"            title="Diet"               type="text"/>
            <field name="information"     title="Interesting Facts"  type="text"  length="1000"/>
            <field name="picture"         title="Picture"            type="image" detail="true"
                   imageURLPrefix="/isomorphic/system/reference/inlineExamples/tiles/images/"/>
        </fields>
    </DataSource>
    Steps to reproduce:
    1. Load testcase
    2. Click "Scentific Name" to sort by that column
    3. (No DS Request is issued, client side sort)
    4. Click "Invalidate cache". A DS Request is issued, sorting by "Scentific Name")
    5. Group by "Diet"
    6. (No DS Request is issued, client side grouping)
    7. Click "Animal" to sort by that column
    8. (No DS Request is issued, client side sort)
    9. Click "Invalidate cache". A DS Request is issued, sorting by "Scentific Name")


    In the end, the ListGrid is still sorted correctly, but this must have happened on the client side.
    This seems to happen only in grouped ListGrids.

    Best regards,
    Blama
    Last edited by Blama; 25 Jul 2014, 06:04.

    #2
    Hi Isomorphic,

    can you reproduce this behaviour?

    Best regards,
    Blama

    Comment


      #3
      Yes, we can - we'll fix it in the coming days and update here at that time - in the meantime, it's harmless and you can ignore it.

      Comment


        #4
        This has now been addressed - please retest with a build dated August 20 or later.

        Comment


          #5
          Hi Isomorphic,

          took some time to retest, but this is fixed for me (using v10.0p_2015-05-21).

          Best regards
          Blama

          Comment

          Working...
          X