I am using Infragistics 15.2 with JQuery 1.11.3 and JQuery UI 1.11.4.
I have an igGrid using the "Append Rows on Demand" feature. My data source is a JSON object which is returned from an AJAX call.
Here is a sample of my data source with 1 record:
[{ "TotalRowCount":"1404", "DataRecords":[{ "ID":"ced1b903-d378-e511-80f1-8a6026a92b47", "ContractNumber":"16453", "Surname":"Smith", "Status":"New Order", "Cemetery":"Land of Memory", "CustomerName":"John Smith", "Store":"ABC Monument Works", "DateCreated":"10/22/2015 10:39:01 AM" }]}]
Here is the code for my grid:
UPDATE:
The initial chunk will now load successfully after changing this line
responseDataKey: "DataRecords"
to
responseDataKey: "0.DataRecords"
However, I am still unable to load additional rows when clicking the "Load more data" button. No AJAX call gets made when I click the button and the same is happening when I use loadTrigger: "auto".
Why would this be happening? Am I using an incompatible version of JQuery possibly?
Hello Jack,
The reason responseDataKey: "DataRecords" is not working is because the data returned is an array. That's also the reason for the "Load more data" button not working. You should change your returned data to be wrapped in an object and set responseDataKey: "DataRecords".
Also, your column keys should not contain "DataRecords". Just use the name of the property as a column key.
Last, instead of dataSourceUrl use just dataSource.
Hope this helps,Martin PavlovInfragistics, Inc.
Martin,
Thank you for your help and for the explanation.
It's a valid configuration. Your original problem was that the igGrid couldn't find the number of records in the data source, thus it didn't initiate a remote request on "Load more data" click. Setting recordCountKey: "0.TotalRowCount" fixed that.
Best regards,Martin PavlovInfragistics, Inc.
FIXED:
I fixed the problem by simply changing this line in my original post:
recordCountKey: "TotalRowCount"
recordCountKey: "0.TotalRowCount"
The "AppendRowsOnDemand" feature now works perfectly. Is this an unusual implementation? I wasn't able to get it working any other way.
Martin Pavlov"] You should change your returned data to be wrapped in an object
You should change your returned data to be wrapped in an object
What exactly do you mean by this? I tried to return the data as a .NET DataTable rather than an array, but the grid throws one of the following exceptions:
Uncaught Error: 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: ID
- OR -
Uncaught Error: The response type was either not set correctly, or it was not possible to detect it automatically. Please set settings.responseDataType and/or settings.responseContentType.
My DataTable has a column called "DataRecords" whose value is another DataTable with all the correct columns in my grid.