Hi,
I have difficulties in retrieving data from my server page by page in a list grid. I get the first page, but when i get to the end of the list grid, the client doesn't ask for the next window of records.
Here is my client code:
The server side responds with the following json message:
What have I missed in my code?
I have difficulties in retrieving data from my server page by page in a list grid. I get the first page, but when i get to the end of the list grid, the client doesn't ask for the next window of records.
Here is my client code:
Code:
isc.DataSource.create({ ID:"testRows", dataURL:"testTotalRows.php", dataFormat:"json", recordXPath: "response/data", transformRequest : function (dsRequest) { if (dsRequest.operationType == "fetch") { var params = { startRow : dsRequest.startRow, endRow : dsRequest.endRow }; // combine paging parameters with criteria return isc.addProperties({}, dsRequest.data, params); } }, transformResponse: function(dsResponse, dsRequest, data) { if (dsRequest.operationType == "fetch") { dsResponse.startRow = isc.XMLTools.selectNumber(data, "response/startRow"); dsResponse.endRow = isc.XMLTools.selectNumber(data, "response/endRow"); dsResponse.totalRows = isc.XMLTools.selectNumber(data, "response/totalRows"); dsResponse.status = isc.XMLTools.selectNumber(data, "response/status"); } return dsResponse; }, fields:[ { name : "a", title: "ColA"}, { name : "b", title: "ColB"}, ] }); isc.ListGrid.create({ ID:"adGrid", left:100, top:50, width:150, height:100, showAllRecords:true, alternateRecordStyles:true, dataSource:"testRows", dataPageSize: 5, autoFetchData:true });
Code:
{"response": {"status":0,"startRow":0,"endRow":7,"totalRows":100, "data":[{"a":"A0","b":"B0"},{"a":"A1","b":"B1"},{"a":"A2","b":"B2"}, {"a":"A3","b":"B3"},{"a":"A4","b":"B4"},{"a":"A5","b":"B5"}, {"a":"A6","b":"B6"}] } }
Comment