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
80
Basic sample, but get javascript error in ig.ui.min
posted

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}

(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

Parents
  • 24671
    posted

    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 

Reply Children