Announcement

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

    Bug: ListGrid.setCriteria() broken

    Hi Isomorphic,

    please see this minimal testcase on how ListGrid.setCriteria() is broken for SC_SNAPSHOT-2011-12-05/EVAL Deployment 2011-12-05 and
    v8.2p_2012-04-18/EVAL Deployment 2012-04-18:

    SQL (Oracle):
    Code:
    DROP TABLE t_test CASCADE CONSTRAINTS ;
    DROP SEQUENCE T_TEST_ID ;
     CREATE TABLE t_test
        ( id INTEGER NOT NULL, num INTEGER, datum DATE
        ) ;
    CREATE SEQUENCE T_TEST_ID NOCACHE ORDER ;
    CREATE OR REPLACE TRIGGER t_test_BI BEFORE
       INSERT ON t_test FOR EACH ROW WHEN(NEW.id IS NULL) BEGIN
       SELECT T_TEST_ID.NEXTVAL INTO :NEW.id FROM DUAL;
    END;
    /
     INSERT INTO t_test
        (datum, num)
     SELECT sysdate - rownum, rownum FROM dual CONNECT BY level < 10;
    COMMIT ;
    Client Java:
    Code:
    package com.smartgwt.sample.client;
    
    import com.smartgwt.client.data.Criteria;
    import com.smartgwt.client.data.Criterion;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.types.OperatorId;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.layout.VLayout;
    import com.google.gwt.core.client.EntryPoint;
    
    public class Testcase implements EntryPoint {
    	@Override
    	public void onModuleLoad() {
    		VLayout vL = new VLayout() {
    			{
    				setWidth100();
    				setHeight100();
    				final DataSource testDS = DataSource.get("T_TEST3");
    
    				final ListGrid testLG = new ListGrid() {
    					{
    						setDataSource(testDS);
    
    						Criterion criterion = new Criterion("NUM", OperatorId.EQUALS, 3);
    						Criteria criteria = new Criteria("NUM", "3");
    						setCriteria(criteria);
    //						setCriteria(criterion);
    						fetchData();
    //						fetchData(criteria);
    					}
    				};
    				addMember(testLG);
    			}
    		};
    		vL.draw();
    	}
    }
    .ds.xml
    Code:
    <DataSource schema="testcase" dbName="Oracle" tableName="T_TEST" ID="T_TEST3" dataSourceVersion="1"
    	serverType="sql"
    >
    	<fields>
    		<field primaryKey="true" hidden="true" name="ID" type="sequence"></field>
    		<field name="DATUM" type="date"></field>
    		<field name="NUM" type="int"></field>
    		<field name="NUM2" nativeName="num" type="int"></field>
    	</fields>
    </DataSource>
    fetchData() does not use the object set in either setCriteria(criteria) or setCriteria(criterion). I have to do fetchData(criteria).

    Best regards,
    Blama

    #2
    fetchData() replaces the current criteria with whatever is passed, including no criteria. See the docs.

    Comment

    Working...
    X