开发者

Telerik Grid (MVC) does not display returned JSON

I have a telerik MVC grid. After making some changes to the underlying code, the grid no longer shows the results returned from the server. I can see the correctly formatted JSON return from the server (using functionality from Web Developer Toolbar), but the grid never actually shows the data. However, it also doesn't generate an error. The loading icon just keeps spinning. Does anyone have a suggestion on how to localize the problem? Thanks.

EDIT Well, I managed to get a step further. Apparently something goes wrong in the "bindData"-function located in telerik.grid.js. More specifically in line 462:

460. var evaluate = column.display;
461. if (evaluate)
462.    html.cat(evaluate(data[rowIndex]));  

When trying to render the last column in the first row, evaluate is set to anonymous and somehow, this results in an "invisible" exception. The markup of this column is:

columns.Bound(c => c.DocumentId)
    .ClientTemplate("<a href=\"" + Url.Content("/") +
        "/document/<#= DocumentId #>\" target=\"_blank\"><#= Naam #></a>")
    .Filter开发者_JAVA技巧able(false)
    .Title("Naam");

I don't understand why this would be a problem, as I use similar templates elsewhere without any problem.

EDIT Ok, I got it. Apparently some exceptions will not be shown in the Firefox/Firebug console. However, Visual Studio together with IE do not have this problem. I finally discovered that indeed the field "Naam" was missing in the IEnumerable.

So something to take away here is never to trust the results from just one browser ;-)


I had a similar behaviour recently when I had changed the type that the grid was expecting.

Make sure that your ajax call is returning the correct IEnumerable that is specified in the grid markup.

You need to post code for the GridAction and markup if you want a more accurate answer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜