igGrid problem with remote paging not recognizing the returned Json object

I'm having a problem with remote paging. It is not reading my reply properly and throwing a parse error. Here is my grid definition:

                dataSource:  "/SrvGrid?action=getList",
                columns: [   
                            { headerText: "ID",   key: "dataId", },
                            { headerText: "Data", key: "data",   }
                features: [{
                            name: 'Paging',
                            type: "remote",
                            pageSize: 2,
                            responseDataKey : "records",
                            recordCountKey  : "totalRecordCount",
                            pageSizeUrlKey  : 'pageSize',
                            pageIndexUrlKey : 'pageIndex'

I am getting the proper reqest parms sent to my servlet :


My servlet queries the DB to create a list and then I build a Wrapper class around it (I don't know if this is correct or if theres an easier way) :

    class Wrapper {
        public int        totalRecordCount;
        public List<Data> records;

The return JSon string looks like this :


and it looks/parses fine in Firebug - an object with 2 elements, the 'totalRecordCount' and 'records', exactly as specified in the Paging feature of the grid. However, it returns this error:

    Error: The remote request to fetch data has failed: (parsererror) There was an error parsing the JSON data and applying the defined data schema: The input data doesn't match the schema, the following field couldn't be mapped: dataId

I have no idea why this is not working. I thought the grid would stripoff the wrapper and and use just the 'records' property to populate the grid.

Strangely enough, if the servlet just passes back my data in the Json 'list' (WITHOUT the Wrapper), it is parsed correctly and the grid is loaded. So it seems to recognize that its remote paging when SENDING the request (by adding the paging parms) but it doesnt recognize that its using remote paging when RECEIVING the result - it doesnt know what to do with the 'totalRecordCount' and 'records' properties.

Can you help?


Parents Reply Children