Announcement

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

    Bug: ListGrid::setUpdateOperation is ignored

    Hello,

    The Following TestCase shows, that the current nightly build of SmartGWT 3.1p LGPL 2012/11/27 ignores the operationId defined for update requests:

    Code:
    	public void onModuleLoad() {
    		ListGrid lg = new ListGrid();
    		lg.setFetchOperation("foooFetch");
    		lg.setUpdateOperation("foooUpdate");
    		lg.setCanEdit(true);
    		DataSource ds = new DataSource();
    		ds.setClientOnly(true);
    		DataSourceField pk = new DataSourceField("pk", FieldType.TEXT);
    		pk.setPrimaryKey(true);
    		ds.setFields(pk,new DataSourceField("foo", FieldType.TEXT));
    		ds.setTestData(new Record() {{
    			setAttribute("pk", "1");
    			setAttribute("foo", "bar");
    		}});
    		lg.setDataSource(ds);
    		lg.setAutoSaveEdits(true);
    		lg.setAutoFetchData(true);
    		lg.draw();
    	}
    As you can see in the SmartClient-Console the operationId for the fetch is set correctly, but after modifying the Record the operationId is missing for the update request.

    #2
    operationIds do not apply to client-only DataSources.

    Are you seeing an analogous issue with a DataSource where operationIds actually apply? Because we have automated tests for this, and they are passing.

    Comment


      #3
      The problem also occurs with the RestDataSource. The clientOnly was just for the simplification of the TestCase.

      Comment


        #4
        We're not showing an issue with RestDataSource, so please show how you're reproducing this.

        You don't need to show an actual response, it's sufficient for the test case to simply send a request that omits operationId.

        Comment


          #5
          Code:
          		ListGrid lg = new ListGrid();
          		lg.setFetchOperation("foooFetch");
          		lg.setAddOperation("foooUpdate");
          		lg.setUpdateOperation("foooUpdate");
          		lg.setCanEdit(true);
          		RestDataSource ds = new RestDataSource();
          
          		DataSourceField pk = new DataSourceField("pk", FieldType.TEXT);
          		pk.setPrimaryKey(true);
          		ds.setFields(pk, new DataSourceField("foo", FieldType.TEXT));
          		lg.setDataSource(ds);
          		ds.setCacheAllData(true);
          		ds.setCacheData(new Record() {{
          			setAttribute("pk", "1");
          			setAttribute("foo", "bar");
          		}});
          		lg.fetchData(new Criteria("pk", "1"));
          		lg.setAutoSaveEdits(true);
          		lg.draw();
          If you use this code, you can see in the Smartclient-Console that after updating the record no operationId is used.
          Attached Files

          Comment


            #6
            I debuged a little bit and here is the result:

            the update operation has following call stack:

            Code:
            isc.RestDataSource.addProperties.transformRequest (RestDataSource.js:875)
            isc.DataSource.addMethods.getServiceInputs (DataSource.js:9341)
            isc.DataSource.addMethods.sendDSRequest (DataSource.js:12587)
            isc.DataSource.addMethods.performDSOperation (DataSource.js:12422)
            isc.DataSource.addMethods.updateData (DataSource.js:12232)
            isc.ListGrid.addMethods.saveEditedValues (ListGrid.js:29702) <------ Line 29647
            isc.ListGrid.addMethods.saveEdits (ListGrid.js:29173)
            isc.ListGrid.addMethods.saveAllEdits (ListGrid.js:29440)
            In the RestDataSource the operationId is set from the request parameter 'operationId' but there is no such parameter. Instead there is the parameter 'operation' containing the operationId, which ist set at line 2947 in the ListGrid.js

            compared to this, here is the call stack of the fetch operation:

            Code:
            isc.RestDataSource.addProperties.transformRequest (RestDataSource.js:875)
            isc.DataSource.addMethods.getServiceInputs (DataSource.js:9341)
            isc.DataSource.addMethods.sendDSRequest (DataSource.js:12587)
            isc.DataSource.addMethods.performDSOperation (DataSource.js:12422)
            isc.DataSource.addMethods.fetchData (DataSource.js:11899)
            isc.ResultSet.addMethods.fetchRemoteData (ResultSet.js:1361)
            isc.ResultSet.addMethods._fetchRemoteData (ResultSet.js:1286)
            isc.ResultSet.addMethods.getRangePaged (ResultSet.js:2918)
            isc.ResultSet.addMethods._getRangePaged (ResultSet.js:2813)
            isc.ResultSet.addMethods.getRange (ResultSet.js:1025)
            isc.ListGrid.addMethods.requestVisibleRows (ListGrid.js:19468)
            isc.Canvas.addProperties.filterWithCriteria (DataBoundComponent.js:3346)
            isc.Canvas.addProperties._filter (DataBoundComponent.js:3306)
            isc.Class.addClassMethods.invokeSuper (Class.js:1365)
            isc.Class.addClassMethods.Super (Class.js:1210)
            isc.ListGrid.addMethods._filter (ListGrid.js:27582)
            isc.Canvas.addProperties.fetchData (DataBoundComponent.js:2985)
            isc.Canvas.addProperties.doInitialFetch (DataBoundComponent.js:3164)
            here the param 'operationId' is set correctly and the param 'operation' is a json object.

            Comment


              #7
              Thanks for the follow up. We agree with your analysis and have made a change to address this. This will show up in the nightly builds going forward (3.1p and 4.0d branches)

              Regards
              Isomorphic Software

              Comment

              Working...
              X