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

[Solved] telerik.grid.js error

4 Answers 93 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.
Charley
Top achievements
Rank 1
Charley asked on 19 Jul 2011, 08:37 PM
I am getting this terrible error.  I am not certain why.  I am including the error and line of js telerik js file as well.

error information.
Error: this.dataSource is undefined
Source File: telerik.grid.js
Line: 1498

this is in the layout page
@(
       Html.Telerik().ScriptRegistrar()
           .DefaultGroup(group => group
               .Add("telerik.grid.editing.js")
               .Compress(true)
           )
 
   )





Here is the razor page.  This code worked before and mysteriously stopped working.  I obviously made some sort of innocuous change that broke something. This is only part of the razor code.  Thanks for the reply.

<div id="bottomhalf">
        <div id="repairlines">
            <div class="t-web20">
            @(
                Html.Telerik().Grid((List<IMRS.Model.WorkOrderRepairLine>)ViewData["workOrderRepairLine"])
                    .Name("WorkOrderRepairLines")
                    .Columns(c =>
                    {
                        c.Bound(o => o.WorkOrderRepairLineStatusId).ReadOnly().Title("Status").Width(50);
                        c.Bound(o => o.Description).Title("Description").ReadOnly().Width(150);
                        c.Bound(o => o.JobCodeDescription).ReadOnly().Title("Job Code").Width(50);
                        c.Bound(o => o.WhyMadeCodeDescription).Title("Why Made Code").ReadOnly().Width(100);
                        c.Bound(o => o.ConditionCodeDescription).Title("Condition Code").ReadOnly().Width(100);
                        c.Bound(o => o.UnitLocationCodeDescription).Title("Location").ReadOnly().Width(20);
                        c.Bound(o => o.DefectQuantity).ReadOnly().Width(50);
                        c.Bound(o => o.DefectSize).ReadOnly().Width(50);
                        c.Bound(o => o.RepairQuantity).ReadOnly().Width(50);
                        c.Bound(o => o.RepairSize).ReadOnly().Width(50);
                        c.Bound(o => o.ResposibilityCodeDescription).Title("Responsibility Code").ReadOnly().Width(100);
                        c.Bound(o => o.J2ActivityID).Title("J2").ReadOnly().Width(50);
                        c.Bound(o => o.LaborAmount).Title("Labor").ReadOnly().Width(70);
                        c.Bound(o => o.MaterialAmount).Title("Material").ReadOnly().Width(70);
                        c.Bound(o => o.TaxAmount).Title("Tax").ReadOnly().Width(70);
                    })
                    .ClientEvents(events => events
                        .OnLoad("onDataBinding")
                    )
                    .Sortable()
                )
            </div>
        </div>
    </div>
    @{Html.EndForm();}
</div>
<script type="text/javascript">
    var grid = null;
    function onDataBinding(result)
    {
        grid = $(this).data('tGrid');
    }
 
    var currentInvoice;
    function UpdateWorkOrder(id)
    {
        $.ajax({
            url: 'http://imrsrs/workorderservice/' + id + '',
            data: {},
            type: "GET",
            success: function (data) {
                //alert(data.Company.CompanyName);
            },
            dataType: "jsonp",
            jsonpCallback: "localJsonpCallback"
        });
    }
 
    function localJsonpCallback(json)
    {
        currentInvoice = json;
        grid.dataBind(json.WorkOrderRepairLines);
    }
 
</script>

4 Answers, 1 is accepted

Sort by
0
Charley
Top achievements
Rank 1
answered on 19 Jul 2011, 09:57 PM
Found the problem.  I was a victim of updated JavaScript files from colleague.  Thanks for looking any ways.  Regards
0
Charley
Top achievements
Rank 1
answered on 20 Jul 2011, 01:16 PM
We were using the version of Telerik controls before q2 2011.  We are have updates.  What is the difference between the calls to fill the grid in the new version. 


Thanks for the reply.
0
Charles
Top achievements
Rank 1
answered on 29 Aug 2011, 05:57 PM
I'm getting a similar error and can't figure it out for the life of me.

We also were using an older version and the dataBind method is throwing that same error after the Telerik controls update.

What exactly was your problem?

Any help in diagnosing my problem would be great. :-)
0
Charley
Top achievements
Rank 1
answered on 29 Aug 2011, 06:28 PM
Charles

What I ended up doing is using the IE9 DOM inspector and its javascript profiler.  I found a problem with a call timing issue or something to that sort.  It was rather silly actually.  It might have even been something being called incorrectly to the new API but it was surely something silly once looked at in the profiler.  I find it useful to put try catche blocks on my javascript in third party api's.  It is very easy for the api to handle all the errors for even the ones they have problems with.  The try catch will allow you to catch things not ordinarily available to you.  Hope this helps.

Regards
Tags
Grid
Asked by
Charley
Top achievements
Rank 1
Answers by
Charley
Top achievements
Rank 1
Charles
Top achievements
Rank 1
Share this question
or