Hello, I try to use ig.RemoteDataSource and property responseDataKey (response in JSON) in IgniteUi 15.2. In many examples in the documentation, the property is used with the values "d" or "d.results". I can not use anything in replacement of "d". example: d.rows: OK d.test: OK data.rows: NOK Apparently this does not work when the root property is not "d". Thanks for your help
Hi GBAU,
It's my understanding that this is the default syntax for when an OData Service returns json. More details regarding this standard is available in the oData Documentation:http://www.odata.org/documentation/odata-version-2-0/json-format/ If you wish to change this, you will need to make the appropriate changes to your service.
I hope this helps. Please let me know if you have additional questions regarding this matter.
Hi,
Thanks for your reply but I'm frightened by your answer. I use a generic object RemoteDataSource, not a ODataRemoteDataSource if it exists. Why when using "results" or "otherKey" directly it works (though not in the OData specifications) while "otherKey1.otherKey2" does not? Thanks
Indeed it works when I configure paging in "local" mode.
Thanks
Thank you for the sample you've provided as this gives us a better understanding of the issues you're encountering.
After reviewing your sample, I see that you're using the igGrid's Server Side Paging feature. To prevent the "Cannot read property '__count' of undefined" error you're currently encountering, I recommend settings the Paging Type option to "local" as this will prevent the igRemoteDataSource to getting the record count from the remote request.
Alternatively, if you're returning the record count through your request, I recommend setting the responseTotalRecCountKey option for the igRemoteDataSource accordingly. Note, this option is required when using remote paging.
Please let me know if you have additional questions regarding this matter.
I made an example.
It is based on this example: http://www.igniteui.com/grid/overview
I just added a remoteDataSource who call simply a .json file (IIS returns application/json as content-type with this extension) (in my real case it is a .ashx .NET)
Thanks for your help
Hello,
Thank you for the update. I have done some looking into this matter and testing and when I use a datasource with “data.rows” as the responseDataKey field it works without issue. Can you tell us more about your setup? What controls are you using with the datasource? Do you have an isolated sample that reproduces this behavior for you?
Hi, I think you have not understood my problem If my service returns this:
{ "data": { "rows": [{ "ProductID": "1", "ProductName": "Produit 1", "CategoryName": "Categorie 4", "ImageUrl": "./images/dummies/1.jpg", "InStock": "219" }, { "ProductID": "2", "ProductName": "Produit 2", "CategoryName": "Categorie 4", "ImageUrl": "./images/dummies/2.jpg", "InStock": "124" }] }}And I put "data.rows" the property "responseDataKey", it should work?Thanks