Hi, I’m trying to bind a knockout view to a readonly datasource like defined like so
<table id="grid" data-bind="
igGrid: {
dataSource: igDataSource,
width: 1100,
height: 500,
primaryKey: 'CustomerID',
autoCommit: false,
features: [{
name: 'Updating', editMode: 'row',
}
],
autoGenerateColumns: false,
columns: [
{ key: 'CustomerID', headerText: 'Customer ID', width: 80, dataType: 'string' },
{ key: 'Country', headerText: 'Country', width: 150, dataType: 'string' },
{ key: 'City', headerText: 'City', width: 100, dataType: 'string' },
{ key: 'ContactName', headerText: 'Contact Name', width: 270, dataType: 'string' },
{ key: 'CompanyName', headerText: 'Company Name', width: 200, dataType: 'string' },
{ key: 'Address', headerText: 'Address', width: 200, dataType: 'string' },
{ key: 'Phone', headerText: 'Phone', width: 100, dataType: 'string' }
]
}"
</table>
self.igDataSource =
new $.ig.JSONPDataSource({
dataSource: fc.ActionUrls.Pending.Tasks,
type: "remoteUrl",
responseDataKey: "Results",
});
Or
new $.ig.KnockoutDataSource({
type: 'remoteUrl',
responseDataKey: 'Results'
But keep getting:
"Cannot determine the data source type. Please specify if it is JSON or XML data."
Can someone please provide a simple sample to do this.
Thank you
Regard Christoffel
Hi Christoffel,
When type is set to 'remoteUrl' you can specify the response data type using "responseDataType" option. In the following snippet I've reused your code and I've added the responseDataType option set to "jsonp".
responseDataKey: 'Results',
responseDataType: "jsonp",
responseDataType:
"jsonp"
,
Hope that helps,
Thanks,
Hi Todor, I did exactly as you suggested but I am still receiving the same error message.