JSON format for DataSource

Hi

I am fooling around with SC a bit but stumbled across a odd issue.

In the docs(http://www.smartclient.com/docs/6.5.1/a/b/c/go.html#type..DSDataFormat) it shows a certain format for the JSON. Which in my case does not get displayed in a listgrid

The exact JSON as show by firebug is:

{"startRow": 0, "data": [{"lastname": "last1", "firstname": "first1", "title": "Mr"}, {"lastname": "last2", "firstname": "first2", "title": "Mr"}], "totalRows": 2, "endRow": 2}

Though if I follow the example of the doc listed above it works fine. That JSON is:

[{"lastname": "last1", "firstname": "first1", "title": "Mr"}, {"lastname": "last2", "firstname": "first2", "title": "Mr"}]

Why is that so?

PS My code is as follows incase it is required

isc.DataSource.create({
    ID:'peopleDS',
    fields: [
        {name:"title", title:"Title"},
        {name:"firstname", title:"First Name"},
        {name:"lastname", title:"Last Name"}
    ],
    dataFormat:"json",
    dataURL:'/people'
});

isc.Window.create({
    ID: "modalWindow",
    title: "Window",
    autoSize:true,
    autoCenter: true,
    isModal: true,
    showModalMask: false,
    autoDraw: false,
    showCloseButton: false,
    showMinimizeButton: false,
    items: [
        isc.ListGrid.create({
            ID: "contactsList",
            dataSource:'peopleDS',
            autoFetchData: true,
            left: 50, top: 50,
            width: 600,
            height: 400,
            alternateRecordStyles:true, showAllRecords:true
        })
    ]
});

modalWindow.show();

It seems I may have the answer(Partly) after some further forum crawling at http://forums.smartclient.com/showthread.php?p=4408

Though it still confuses me that the docs will specifically mention a format without mentioning transformResponse nor recordXPath.

Am I missing something?

The docs you referred to discuss only the mechanics of delivering a JSON response, that is, whether a “var” declaration is expected. The format of the actual data differs according to other settings on your DataSource (recordXPath, etc). I suppose this particular doc would be clearer if it didn’t happen to use property names that match one of the possible formats, and referred explicitly to the overviews of response processing found elsewhere - we’ll add that.

However in a nutshell:

For a complete pre-made request and response protocol that you can use as a cookbook approach for server integration, see RestDataSource.

To adapt to pre-existing request and response protocols, start with DataSource and use the approach described for client-side data integration.

Thanks for your reply.

Seems like some more RTFM is required :stuck_out_tongue_winking_eye: