Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1390
Readonly Knockout data source sample
posted

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

 

self.igDataSource =                         
                          new $.ig.KnockoutDataSource({                                
                                   dataSource: fc.ActionUrls.Pending.Tasks,
                                   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

Parents Reply Children
No Data