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
1015
Reading oData from ASP.NET Web API
posted

I have some oData coming back from the lastest ASP.NET web api that looks like this:

{
  "odata.metadata":"http://mydomain/odata/$metadata#Users",
  "odata.count":"3",
  "value":[
    {"FirstName":"Alan","MiddleName":"A.","LastName":"Arlington"},
	{"FirstName":"Brad","MiddleName":"B.","LastName":"Boston"},
	{"FirstName":"Dirk","MiddleName":"J.","LastName":"Watkins"}
  ]
}

How can I bind this to the igCombo?  Notice that the total record count has a dot in the property name.  Also, how do I get the igCombo to stop looking for a root of "d"?

I've tried tons of stuff, including the below.  Any ideas?

        var usersDS = new $.ig.RemoteDataSource({
		dataSource: '/odata/Users?',
		type: 'json',
		responseDataType: 'json',
		responseTotalRecCountKey: 'odata.count',
		responseDataKey: 'value',
	});


	$('#combo').igCombo({
		loadOnDemandSettings: {
			enabled: true,
			pageSize: 10
		},
		mode: 'readonlylist',
		dataSource: usersDS,
		filteringType: 'remote',
		width: '250px',
		textKey: 'LastName',
		valueKey: 'FirstName',
		virtualization: true,
		autoComplete: true,	
		itemTemplate: '${FirstName} ${LastName}',
		nullText: 'Select an employee'
        });
Parents
No Data
Reply
  • 40
    posted

    I am interested in the solution to this problem too. I am using web api from VS 2012.2 update.

Children