This is a migrated thread and some comments may be shown as answers.

Grid won't bind / display data

5 Answers 173 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tycho
Top achievements
Rank 1
Tycho asked on 28 Jun 2012, 07:05 AM
Hi all,

I've got a grid that won't bind / display data. 

Datasource:
var ds = new kendo.data.DataSource({
    type: "odata",
    transport: {
        read: {
            url: dataUrl,
            dataType: "jsonp",
            jsonp: "callback",
            jsonpCallback: 'DataCallBack'
        }
    },
    error: function (e) {
            alert("Error2: " + e);
    },
    serverPaging: true,
    pageSize: 10
});

Using firebug i can see a request is being made and the following data in JSONP format is returned by the service: 
DataCallBack( [{"RunStatusTag":null,"Service":"Charge Pump","SiteName":"FCCU"},{"RunStatusTag":null,"Service":"Charge Pump 2","SiteName":"FCCU2"},{"RunStatusTag":null,"Service":"Charge Pump3","SiteName":"FCCU3"}] );

The grid is defined as below, the databound event never fires:
$("#grid2").kendoGrid({
    dataSource:ds,
    dataBound: function(e) {
         alert("Bound2 " + e);
    },
    columns: [
            {   field:"SiteName",title: "Plant/Facility" },
            {   field:"Service",title: "Service"    }
    ]
});

Any idea's? 

5 Answers, 1 is accepted

Sort by
0
Jerry T.
Top achievements
Rank 1
answered on 29 Jun 2012, 06:21 PM

Tycho,

Have you tried defining a schema for the datasource? In your case, add this to the dataSource object (assuming "SiteName" is a key column):
schema: {
data: "d",
model: {
id: "SiteName",
fields: {
RunStatusTag: { nullable: true },
Service: { type: "string" },
    SiteName: { type: "string" }
}
}
}
0
Jesse
Top achievements
Rank 2
answered on 29 Jun 2012, 08:13 PM
What are you using for your service specifically are you using the Web api, Wcf, or some other tehcnology?
0
Tycho
Top achievements
Rank 1
answered on 30 Jun 2012, 07:45 PM
@Jerry: i tried adding a schema before, but not exactly like the one you suggested. I tried yours but still the grid doesn't seem to bind. It doesn't give any errors either.

@Jessy : WCF built in ASP.NET 3.5 running on IIS. It's returning the jsonp described above. I've pasted the request and answer headers that i using firebug below. 

Answer headers soiurce:
Cache-Control private
Content-Encoding gzip
Content-Length 1451
Content-Type application/json; charset=utf-8
Date Sat, 30 Jun 2012 19:38:01 GMT
Server Microsoft-IIS/7.5
Vary Accept-Encoding
X-AspNet-Version 2.0.50727
X-Powered-By ASP.NET

Requist header source:
Accept */*
Accept-Encoding gzip, deflate
Accept-Language nl,en-us;q=0.7,en;q=0.3
Cache-Control max-age=0
Connection keep-alive
Host localhost:17592
Referer http://server:9999/pages/pagename.aspx?TN=123&TB=&SD=21/Jun/2012%2003:15%20AM&ED=21/Jun/2012%2011:15%20AM&SI=e400e401-83c1-43e2-bb39-56f76521afab&Level=2&EqID=&EqTyp=All&EqNm=
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0.1

0
Matt
Top achievements
Rank 1
answered on 04 Jun 2015, 08:07 PM
I think I'm having the same issue, but I'm just calling an MVC Controller method instead of a WCF service.  I've caught the call to the server in debug, so I know it's getting that far.  On my dataSource I've got it doing an alert on requestStart and requestEnd, and both of those are firing, but my grid is never firing its dataBound event either.
0
Alexander Valchev
Telerik team
answered on 09 Jun 2015, 08:00 AM
Hi Matt,

This thread is old and outdated, it was created in Jun 2012.

Please open a new thread and provide a sample of the server JSON response so we can examine its structure and verify that the DataSource is configured correctly.

Thank you in advance.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Tycho
Top achievements
Rank 1
Answers by
Jerry T.
Top achievements
Rank 1
Jesse
Top achievements
Rank 2
Tycho
Top achievements
Rank 1
Matt
Top achievements
Rank 1
Alexander Valchev
Telerik team
Share this question
or