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

[Solved] Bug in 2011.2.712 when I Bind JSON on Client Side

1 Answer 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Hardy Wang
Top achievements
Rank 1
Hardy Wang asked on 20 Sep 2011, 02:15 AM
I have some code worked in 2011.1 version, but it breaks in new version. In order to describe the problem, I have created a simplified version of sample project.

Basically I have a Grid defined, and I use Javascript to bind JSON array to the grid on client side, the sample code snippet is )I also attached entire sample project)
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
 
<%= Html.Telerik().Grid<GridTest.Models.ItemViewModel>().Name("MyGrid").Columns(
                columns => {
                    columns.Bound(o => o.Name).Title("Name");
                    columns.Bound(o => o.Keyword).Title("Keyword");
                    columns.Bound(o => o.Id)
                        .ClientTemplate("<a id='edit<#= GoodsId #>' class='GridEditButtonStyle'>Edit</a>").Title("");
                }).Resizable(resizing => resizing.Columns(true))
                %>
 
<br />
<input type="button" id="MyButton" value="Click Me" />
<script type="text/javascript">
    $(document).ready(function () {
        $('#MyButton').click(function () {
            var data = [{ "Id": 1, "Name": "Name 1", "Keyword": null }, { "Id": 2, "Name": "Name 2", "Keyword": "Keyword"}];
 
            var grid = $('#MyGrid').data('tGrid');
            grid.dataBind(data);
        });
    });
</script>
</asp:Content>

When I clicked on the button the JavaScript code was exeuted, I set break point on grid.dataBind(data), step through, the next line was executed in file telerik.grid.min.js of statement dataBind:function(l){this.dataSource.success(l)}.

The exception message is got from there is
SCRIPT5007: Unable to get value of the property 'success': object is null or undefined
telerik.grid.min.js, line 1 character 25697

Any clue? What is the change from last version or is it a bug?

Thanks
Hardy

1 Answer, 1 is accepted

Sort by
0
Hardy Wang
Top achievements
Rank 1
answered on 21 Sep 2011, 01:10 AM
Any update from Telerik? I tried the exactly same code with 2011.1.315 binary and JS files, everything works fine.
Tags
Grid
Asked by
Hardy Wang
Top achievements
Rank 1
Answers by
Hardy Wang
Top achievements
Rank 1
Share this question
or