Announcement

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

  • Isomorphic
    replied
    We're happy the fix is working for you, but although the $H is now gone we still have not been able to reproduce any problems with your most recent sample when we disable the fix. The grid's ResultSet still seems to be updated as expected by your DS.addData() call.

    We'd really like to get a test case for this issue, as down the road, GWT or other third-party libraries might inject extra properties like this and break things again.
    Last edited by Isomorphic; 7th Apr 2019, 14:06.

    Leave a comment:


  • michalg
    replied
    I have just verified that "$H" no longer exist in grid's criteria both in example and my app. Moreover, it also solved my app problem with dataArrived record not being shown in grid.
    Tested in SmartClient Version: SNAPSHOT_v12.1d_2019-03-28/LGPL Development Only (built 2019-03-28).

    I greatly appreciate you.
    MichalG

    Leave a comment:


  • Isomorphic
    replied
    The $H arises from GWT's own internal logic, which caches the result of Object.hashcode() on a JavaScriptObject. We've made a change back to SGWT 5.1p that should prevent that property from interfering with the Framework. It will be in the nightly builds dated 2019-03-28 and beyond. Let us know if that resolves the issue.

    Leave a comment:


  • michalg
    replied
    The main trouble for me is that once "$H" occurs in the grid's criteria then grid is no longer updating its contents on data arrived - no matter if a record is added via updateCaches() or by DataSource.addData().

    Code:
    package pl.com.tech4.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.data.AdvancedCriteria;
    import com.smartgwt.client.data.DataSourceField;
    import com.smartgwt.client.data.OperationBinding;
    import com.smartgwt.client.data.Record;
    import com.smartgwt.client.data.RestDataSource;
    import com.smartgwt.client.data.fields.DataSourceTextField;
    import com.smartgwt.client.types.DSDataFormat;
    import com.smartgwt.client.types.DSOperationType;
    import com.smartgwt.client.types.DSProtocol;
    import com.smartgwt.client.types.FieldType;
    import com.smartgwt.client.types.OperatorId;
    import com.smartgwt.client.util.JSON;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.form.FilterBuilder;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class MainEntryPoint implements EntryPoint {
    
        public void onModuleLoad() {
    
            layout();
            SC.showConsole();
        }
    
        private void layout() {
    
            RestDataSource projectDS = new RestDataSource();
            OperationBinding fetchBinding = new OperationBinding();
            fetchBinding.setOperationType(DSOperationType.FETCH);
            fetchBinding.setDataFormat(DSDataFormat.XML);
            fetchBinding.setDataProtocol(DSProtocol.POSTXML);
            projectDS.setOperationBindings(fetchBinding);
            projectDS.setDataURL("Project.xml");
            projectDS.setClientOnly(true);
    
            DataSourceField idField = new DataSourceField();
            idField.setType(FieldType.SEQUENCE);
            idField.setName("id");
            idField.setPrimaryKey(true);
            idField.setHidden(true);
            DataSourceTextField codeField = new DataSourceTextField();
            codeField.setName("code");
            DataSourceTextField managerField = new DataSourceTextField();
            managerField.setName("manager_code");
            managerField.setCanEdit(false);
            managerField.setValueXPath("manager/code");
    
            projectDS.setFields(idField, codeField, managerField);
    
            FilterBuilder fb = new FilterBuilder();
            fb.setDataSource(projectDS);
            AdvancedCriteria criteria = new AdvancedCriteria();
            criteria.addCriteria("manager_code", OperatorId.ICONTAINS, "B");
            fb.setCriteria(criteria);
    
            ListGrid lg = new ListGrid();
            lg.setAutoFetchData(false);
            lg.setShowFilterEditor(true);
            lg.setDataSource(projectDS);
    
            VLayout main = new VLayout();
            main.setHeight100();
            main.setWidth100();
            main.addMembers(fb, lg);
            main.draw();
    
            lg.filterData(fb.getCriteria());
            SC.logWarn(JSON.encode(lg.getCriteria().getJsObj()));
    
            Record record = new Record();
            record.setAttribute("id", 99999);
            record.setAttribute("code", "r/16/2");
            record.setAttribute("manager_code", "Black");
            projectDS.addData(record);
        }
    }
    Project.xml to run avove example:


    Code:
    <response>
        <requestId>Project_request5</requestId>
        <startRow>0</startRow>
        <endRow>1</endRow>
        <totalRows>2</totalRows>
        <data>
        <Project>
            <id>34872</id>
            <code>r/16</code>
            <description>fixing</description>
            <validFrom>2016-04-10T12:00:00Z</validFrom>
            <validTo>2016-10-07T12:00:00Z</validTo>
            <manager>
                <id>1</id>
                <code>Smith</code>
            </manager>
        </Project>
        <Project>
            <id>36548</id>
            <code>r/16/1</code>
            <description>testing</description>
            <validFrom>2016-04-27T12:00:00Z</validFrom>
            <validTo>2016-05-27T12:00:00Z</validTo>
            <manager>
                <id>2</id>
                <code>Brown</code>
            </manager>
        </Project>
        </data>
        <requestedDataSource>Project</requestedDataSource>
        <status>STATUS_SUCCESS</status>
    </response>

    Unfortunately, I am not able to replicate data cache problem in the sample - it hits me in the application though.

    So far I am using this ugly patch to remove "$H" from criteria on Chrome:

    Code:
        public native void removeDollarHFromCriteria() /*-{
            var prop = "$H";
            var self = this.@com.smartgwt.client.widgets.BaseWidget::getOrCreateJsObj()();
            if (self.data && self.data.getCriteria) {
                var crit = self.data.getCriteria();
                delete crit[prop];
            }
        }-*/;
    If applied after lg.filterData() then grid updates its contents with no problem.

    Thanks,

    MichalG

    Leave a comment:


  • Isomorphic
    replied
    We see the $H in certain situations, such as with Chrome browser, and to that end, the sample is useful. We are looking into why the $H is there.

    However, even without the $H, which we see using Firefox, your sample doesn't work. The server doesn't recognize the request and returns an error. Can you provide us with a working sample? Perhaps you need to set the RestDataSource's dataURL. Have you made any other customizations that you haven't mentioned?

    Leave a comment:


  • michalg
    replied
    Is "$H" in criteria reproducible using my test?
    Should I create a new topic for it?
    Thanks,
    MichalG

    Leave a comment:


  • michalg
    replied
    Hi,

    I also have been struggling with "$H" in criteria for some time. Although it is ignored by grid's fetch and seems to be working fine I recently noticed that it somehow stops grid's caches from working. Another words, once "$H" occurs in grid's criteria, then grid does not update its records even though you add a criteria valid record through datasource.

    Here a good example of producing "$H" into grid's criteria:

    Code:
    package pl.com.tech4.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.data.AdvancedCriteria;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.data.DataSourceField;
    import com.smartgwt.client.data.OperationBinding;
    import com.smartgwt.client.data.RestDataSource;
    import com.smartgwt.client.data.fields.DataSourceDateTimeField;
    import com.smartgwt.client.data.fields.DataSourceTextField;
    import com.smartgwt.client.types.DSDataFormat;
    import com.smartgwt.client.types.DSOperationType;
    import com.smartgwt.client.types.DSProtocol;
    import com.smartgwt.client.types.FieldType;
    import com.smartgwt.client.types.OperatorId;
    import com.smartgwt.client.util.JSON;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.form.FilterBuilder;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class MainEntryPoint implements EntryPoint {
    
        public void onModuleLoad() {
    
            layout();
            SC.showConsole();
        }
    
        private void layout() {
    
            DataSource projectDS = new RestDataSource();
            OperationBinding fetchBinding = new OperationBinding();
            fetchBinding.setOperationType(DSOperationType.FETCH);
            fetchBinding.setDataFormat(DSDataFormat.XML);
            fetchBinding.setDataProtocol(DSProtocol.POSTXML);
            projectDS.setOperationBindings(fetchBinding);
    
            DataSourceField idField = new DataSourceField();
            idField.setType(FieldType.SEQUENCE);
            idField.setName("id");
            idField.setPrimaryKey(true);
            idField.setHidden(true);
            DataSourceTextField codeField = new DataSourceTextField();
            codeField.setName("code");
            DataSourceDateTimeField validFromField = new DataSourceDateTimeField();
            validFromField.setName("validFrom");
            DataSourceDateTimeField validToField = new DataSourceDateTimeField();
            validToField.setName("validTo");
    
            projectDS.setFields(idField, codeField, validFromField, validToField);
    
            FilterBuilder fb = new FilterBuilder();
            fb.setDataSource(projectDS);
            AdvancedCriteria criteria = new AdvancedCriteria();
            criteria.addCriteria("code", OperatorId.ICONTAINS, "test");
            fb.setCriteria(criteria);
    
            ListGrid lg = new ListGrid();
            lg.setAutoFetchData(false);
            lg.setShowFilterEditor(true);
            lg.setDataSource(projectDS);
    
            VLayout main = new VLayout();
            main.setHeight100();
            main.setWidth100();
            main.addMembers(fb, lg);
            main.draw();
    
            lg.filterData(fb.getCriteria());
            SC.logWarn(JSON.encode(lg.getCriteria().getJsObj()));
        }
    
    }
    As you can see grid fetches data using criteria obtained from filterBuilder. If you run this example and look into dev console log you will see:

    Code:
    *15:48:56.860:WARN:Log:{
        "_constructor":"AdvancedCriteria",
        "operator":"and",
        "criteria":[
            {
                "fieldName":"code",
                "operator":"iContains",
                "value":"test"
            }
        ],
        "$H":5
    }
    From this point, grid does not react to updateCaches of its datasource.

    MichalG

    ps reproducible in all SGWT versions I tried including the last one: SNAPSHOT_v12.1d_2019-03-16/LGPL Development Only (built 2019-03-16)

    GWT 2.8.2

    Leave a comment:


  • LukeGarrigan
    replied
    Hi,

    I know this is an old post but it's the first that popped up when searching for $H.

    Some reason $H is getting shoved into criteria making queries fail as a result.

    We are using:
    GWT Version : 2.8.2
    SmartGWT Version : 5.1p
    SmartGWT Build Date : 10/01/2018 09:08
    SmartGWT Edition : Pro Edition
    Best regards,
    Luke

    Leave a comment:


  • Blama
    replied
    Hi Isomorphic,

    SNAPSHOT_v10.1d_2015-07-29 seems to fix the bug in the sample as well as in my application.

    Best regards
    Blama

    Leave a comment:


  • Isomorphic
    replied
    The fix for the latest reported issue will be in nightly builds on 5.1d branch as of tomorrow, July 28. Please, check whether this fix solves your previous issue.

    Regards,
    Isomorphic Software

    Leave a comment:


  • Blama
    replied
    FYI: Removing the empty AdvancedCriteria from the ListGrid-fetches fixes the problem - so it seems to be a problem with empty criteria.

    Best regards
    Blama

    Leave a comment:


  • Blama
    replied
    Hi Isomorphic,

    still using: SNAPSHOT_v10.1d_2015-07-23.

    Please see this testcase:
    .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.DSCallback;
    import com.smartgwt.client.data.DSRequest;
    import com.smartgwt.client.data.DSResponse;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.rpc.RPCManager;
    import com.smartgwt.client.types.OperatorId;
    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.layout.HLayout;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class BuiltInDS implements EntryPoint {
    	private VLayout vL;
    	private TestGrid tG1;
    	private TestGrid tG2;
    	private HLayout hL;
    
    	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();
    			}
    		});
    
    		vL = new VLayout(5);
    		vL.setPadding(20);
    		vL.setWidth100();
    		vL.setHeight100();
    		tG1 = new TestGrid("animals");
    		tG2 = new TestGrid("employees");
    
    		hL = new HLayout(5);
    		hL.setHeight(40);
    		IButton reloadBtn = new IButton("Reload");
    		reloadBtn.setWidth(150);
    		reloadBtn.addClickHandler(new ClickHandler() {
    			@Override
    			public void onClick(ClickEvent event) {
    				vL.removeChild(tG1);
    				vL.removeChild(tG2);
    				tG1.markForDestroy();
    				tG2.markForDestroy();
    				tG1 = new TestGrid("animals");
    				tG2 = new TestGrid("employees");
    				vL.addMember(tG1, 0);
    				vL.addMember(tG2, 1);
    			}
    		});
    
    		hL.addMembers(reloadBtn);
    		vL.addMembers(tG1, tG2, hL);
    		vL.draw();
    		fetchData(computeCriteria());
    	}
    
    	private class TestGrid extends ListGrid {
    		public TestGrid(String mode) {
    			super();
    			setShowFilterEditor(true);
    			setDataSource(DataSource.get(mode));
    			setAutoFetchData(false);
    		}
    	}
    
    	private AdvancedCriteria computeCriteria() {
    		AdvancedCriteria combinedAC = new AdvancedCriteria(OperatorId.AND);
    		return combinedAC;
    	}
    
    	public void fetchData(AdvancedCriteria combinedAC) {
    		AdvancedCriteria combinedAC2 = new AdvancedCriteria(combinedAC);
    		RPCManager.startQueue();
    		tG1.fetchData(combinedAC, new DSCallback() {
    			@Override
    			public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) {
    				if (dsResponse.getStatus() == DSResponse.STATUS_SUCCESS)
    					SC.say("Yay!");
    			}
    		}, new DSRequest() {
    			{
    				setOperationId("countLeads");
    			}
    		});
    		tG2.fetchData(combinedAC2);
    		RPCManager.sendQueue();
    	}
    }
    .html:
    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>BuiltInDS</title>
    <script>
    	var isomorphicDir = "builtinds/sc/";
    </script>
    <script type="text/javascript" src="builtinds/sc/modules/ISC_Core.js"></script>
    <script type="text/javascript" src="builtinds/sc/modules/ISC_Foundation.js"></script>
    <script type="text/javascript" src="builtinds/sc/modules/ISC_Containers.js"></script>
    <script type="text/javascript" src="builtinds/sc/modules/ISC_Grids.js"></script>
    <script type="text/javascript" src="builtinds/sc/modules/ISC_Forms.js"></script>
    <script type="text/javascript" src="builtinds/sc/modules/ISC_DataBinding.js"></script>
    <script type="text/javascript" src="builtinds/sc/skins/Simplicity/load_skin.js"></script>
    <script type="text/javascript" src="builtinds/builtinds.nocache.js"></script>
    </head>
    <body>
    	<script src="builtinds/sc/DataSourceLoader?dataSource=supplyItem,animals,employees"></script>
    	<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
    		style="position: absolute; width: 0; height: 0; border: 0"></iframe>
    </body>
    </html>
    FF26 Dev Mode exception on load
    Code:
    15:44:16.008 [ERROR] [builtinds] Unable to load module entry point class com.smartgwt.sample.client.BuiltInDS (see associated exception for details)
    
    com.google.gwt.core.client.JavaScriptException: (TypeError) @com.smartgwt.client.widgets.grid.ListGrid::fetchData(Lcom/smartgwt/client/data/Criteria;Lcom/smartgwt/client/data/DSCallback;Lcom/smartgwt/client/data/DSRequest;)([Java object: com.smartgwt.client.data.AdvancedCriteria@1225410362, Java object: com.smartgwt.sample.client.BuiltInDS$3@1103779404, Java object: com.smartgwt.sample.client.BuiltInDS$4@1256700242]): _15 is undefined
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:252)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:137)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:589)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:315)
        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
        at com.smartgwt.client.widgets.grid.ListGrid.fetchData(ListGrid.java)
        at com.smartgwt.sample.client.BuiltInDS.fetchData(BuiltInDS.java:87)
        at com.smartgwt.sample.client.BuiltInDS.onModuleLoad(BuiltInDS.java:67)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:423)
        at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:530)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:368)
        at java.lang.Thread.run(Unknown Source)
    FF26 Developer Console Exception on load (deployed):
    Code:
    15:54:20.861:INFO:Log:initialized
    15:54:21.745:INFO:Log:isc.Page is loaded
    15:54:22.701:WARN:Log:Uncaught JavaScript exception: TypeError: _15 is undefined in http://localhost:8080/BuiltInDS/builtinds/sc/modules/ISC_Forms.js, line 317
    Messaging endpoint not responding - remote debugging unavailable.  To fix, make sure you have correctly registered the Messaging servlet in your web.xml
    This does not show the exact error I saw, but also clearly an exception that should not happen.

    Best regards
    Blama

    Leave a comment:


  • Isomorphic
    replied
    We are not able to reproduce the error you are seeing. Perhaps, we are not taking into account important data that you have in your code, so, could you please post your test code to test it?

    Regards,
    Isomorphic Software

    Leave a comment:


  • Blama
    replied
    Hi Isomorphic,

    please disregard the last post. This seems to be the normal position for operator.
    One more observation: If the change the UI so that the generated criteria are not empty, everything is working as expected.

    Best regards
    Blama

    Leave a comment:


  • Blama
    replied
    Hi Isomorphic,

    also please see the 1st request (the 2nd is not visible in the RPC tab because the program crashes before:
    Code:
    {
        dataSource:"V_REPORTING_FUNNEL", 
        operationType:"fetch", 
        operationId:"countLeads", 
        data:{
            operator:"and"
        }, 
        textMatchStyle:"exact", 
        showPrompt:true, 
        oldValues:{
            operator:"and"
        }, 
        requestId:"V_REPORTING_FUNNEL$62713", 
        fallbackToEval:false, 
        lastClientEventThreadCode:"MUP7", 
        bypassCache:true, 
        dataProtocol:"getParams"
    }
    Note how operator:"and" is under data/oldValues and that there is no criteria.

    Best regards
    Blama

    Leave a comment:

Working...
X