Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

about transformResponse in DataSource

$
0
0
SmartGWTPro smartgwtpro 4.1 build 2014-07-18

for some reasons in

http://forums.smartclient.com/showthread.php?t=30838

we are using DataSource for our custom rest service. however, since the data format returned by our service is still same as the default case, that is :

Code:

  {
    "response": {
        "status": 0,
        "startRow": 0,
        "endRow": 76,
        "totalRows": 546,
        "data": [
            {"field1": "value", "field2": "value"},
            {"field1": "value", "field2": "value"},
            ... 76 total records ...
        ]
    }
  }

we'd like to use implementation of transformResponse in RestDataSource :

in ISC_DataBinding
Code:

    transformResponse : function (dsResponse, dsRequest, data) {
        if (dsResponse.status < 0 || !data) {
            // If any request failed, queueStatus must be -1
            dsResponse.queueStatus = -1;
            return dsResponse;
        }

        if (dsRequest.dataFormat == "json") {
            if (isc.isAn.Array(data)) {
                var useSingleEntry = data.length == 1 && data[0] &&
      ......
      ......

to fill in metadata fields in the DSResponse object.

so is there any way to just call this method instead of copying the code from RestDataSource ?

Viewing all articles
Browse latest Browse all 4756

Trending Articles