Hi!
Sorry for posting a trivial question, but I'm playing with the grid control, and have trouble making the most simplest functionality to work.
I get the following error: "rec is undefined" in ig.ui.min, and firebug is telling me this is the error: "(function(){var a=false,b=/xyz/.test(f...a.ig.TrialWatermark=true}})}(jQuery));"
So, is this related to some licensing (the trialwatermark)?
Ok, lets assume it's not. This is what I have:
url = "Test.cshtml?GetData=true"; jsonp = new $.ig.JSONPDataSource({ dataSource: url, responseDataKey: "results" }); $(function () { $("#grid1").igGrid({ autoGenerateColumns: true, dataSource: jsonp, height: '400px', features: [ { name: 'Paging', type: 'remote', // Når står til remote, så sender han queryparametere med automagisk, ikke fått til å funke: http://help.infragistics.com/Help/NetAdvantage/jQuery/2011.2/CLR4.0/html/igGrid_Paging.html pageSize: 20, totalRecCountKey: 'totalRecCount' } ], failure: function (data) { alert("ERROR: " + data); } }); });
And my service is returning this:
{"results":[{"Name":"(tom)0","Age":0,"Street":"1230"},{"Name":"(tom)1","Age":1,"Street":"1232"}],"totalRecCount":2}
{"results":[{"Name":"(tom)0","Age":0,"Street":"1230"},{"Name":"(tom)1","Age":1,"Street":"1232"}],"totalRecCount"
:2}
(server code)
var persons = new List<object>(); for (int i = 0; i < tot; i++) { persons.Add(new { Name = n + i, Age = i, Street = "123" + i * 2 }); } Json.Write(new { results = persons, totalRecCount=tot }, Response.Output);
Any ideas whats wrong?
Larsi
Hi,
I think you shouldn't be instantiating a JSONP data source, but simply set the URL to the dataSource of the grid (looking at the example it seems you are having an MVC application and the resource from where the grid is loaded is in the same domain, so there is no need for JSONP - moreover i don't think it would work out of the box with the above setup).
Could you try changing this in the grid options:
dataSource: jsonp,
to this:
dataSource: url,
responseDataKey: "results"
And let me know if this works? Hope it helps.
Thanks,
Angel
Hi! Thanks for looking into this, sorry about my late response.
No, It did not work. Setting paging to local everything works fine, but as soon as I change into remote page I get errors.
I've created a sample sln you can check: https://skydrive.live.com/redir.aspx?cid=5d0909fd6cd506a0&resid=5D0909FD6CD506A0!281&parid=5D0909FD6CD506A0!134&authkey=!AKO0zK4wCUVjCEs
Thanks for your help