Announcement

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

    RestDataSource.removeData(record) => record empty

    SmartGWT 2.5
    SmartClient Version: SC_SNAPSHOT-2011-08-02/LGPL Development Only (built 2011-08-02)

    IE 8.0.7601.17514

    I'm using RestDataSource and hand written servlets.
    Everything goes fine with fetchData, addData and updateData.

    But with removeData, the servlet only receives parameters
    _operationType="remove"
    isc_dataFormat="json"
    _dataSource="isc_RestDataSource_6"
    isc_metaDataPrefix="_"

    All data from the record I pass to removeData is lost.
    As a workaround, I use a DSRequest and dsRequest.setData(map).
    The values in the map appear as parameters in the servlet.
    Any ideas? Is this a misunderstanding on my side or a bug or ...

    #2
    You might try a different 'dataProtocol' on your rest datasource. I set it to 'postMessage' and that passes the data as the request body.

    Comment


      #3
      The method already is post, as can be seen in the RPCRequest in the Developer Console:
      {
      "actionURL":"riacsc/dispatch/ttw/delete",
      "showPrompt":true,
      "transport":"xmlHttpRequest",
      "useSimpleHttp":true,
      "promptStyle":"cursor",
      "params":{
      "_operationType":"remove",
      "_dataSource":"isc_RestDataSource_6",
      "isc_metaDataPrefix":"_",
      "isc_dataFormat":"json"
      },
      "httpMethod":"POST",
      "sendNoQueue":true,
      "bypassCache":true,
      "callback":{
      "target":[RestDataSource ID:isc_RestDataSource_6]
      },
      "willHandleError":true,
      "serverOutputAsString":true,
      "data":null
      }

      When I set data with dsRequest.setData(map), the data from the map ist there:
      {
      "actionURL":"riacsc/dispatch/ttw/delete",
      "showPrompt":true,
      "transport":"xmlHttpRequest",
      "useSimpleHttp":true,
      "promptStyle":"cursor",
      "params":{
      "aType":"2", <----
      "anId":"Zeitraum I", <----
      "_operationType":"remove",
      "_dataSource":"isc_RestDataSource_6",
      "isc_metaDataPrefix":"_",
      "isc_dataFormat":"json"
      },
      "httpMethod":"POST",
      "sendNoQueue":true,
      "bypassCache":true,
      "callback":{
      "target":[RestDataSource ID:isc_RestDataSource_6]
      },
      "willHandleError":true,
      "serverOutputAsString":true,
      "data":null
      }
      updateData works w/o calling setData:
      {
      "actionURL":"riacsc/dispatch/ttw/update",
      "showPrompt":true,
      "transport":"xmlHttpRequest",
      "useSimpleHttp":true,
      "promptStyle":"cursor",
      "params":{
      "aType":"2", <----
      "anId":"Zeitraum II", <----
      "_operationType":"update",
      "_dataSource":"isc_RestDataSource_7",
      "isc_metaDataPrefix":"_",
      "isc_dataFormat":"json"
      },
      "httpMethod":"POST",
      "sendNoQueue":true,
      "bypassCache":true,
      "callback":{
      "target":[RestDataSource ID:isc_RestDataSource_7]
      },
      "willHandleError":true,
      "serverOutputAsString":true,
      "data":null
      }

      Comment


        #4
        Problem solved. JavaDoc of removeData innocently states
        "record - primary key values of record to delete, (or complete record)"

        but the "real" documentation says
        // if passed a full record, trim it down to primaryKeys.
        // ...
        meaning that if you don't have the primary keys of the DataSource set correctly, removeData will silently remove your record attributes.

        I am beginning to doubt that RestDataSource is the way to go for me ...

        Comment

        Working...
        X