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

[Solved] missing ; before statement in telerik.grid.min.js

11 Answers 231 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.
Anthoni
Top achievements
Rank 1
Anthoni asked on 22 Nov 2010, 11:15 PM
Hi,

Update: I am using version Q3 and the errors show up on both FF 3.6 an IE8.

I have a Telerik MVC grid that's bound to data table. Sorting and paging work fine. It's just this annoying javascript errors (see screen shot attached) that I am not able to get rid of. Any help would be much appreciated.

<%  Html.Telerik().Grid(Model.Table)
    .PrefixUrlParameters(false)
    .EnableCustomBinding(true)
    .Name(ViewData["GridName"].ToString())
    .ToolBar(commands => commands
                .Custom().Text("Export to Excel").Action(ViewData["ExportAction"].ToString(), "Export")
    )
    .CellAction(cell =>
    {
        if (ViewData["GridName"].ToString() == "val1" || ViewData["GridName"].ToString() == "val2")
        {
            cell.HtmlAttributes["class"] = "class-" + cell.DataItem.Row[cell.Column.Member];
        }
        else if (ViewData["GridName"].ToString() == "Eou")
        {
            if (cell.Column.Title != "Some Number")
            {
                var text = cell.DataItem.Row[cell.Column.Member].ToString().Trim();
                cell.HtmlAttributes["class"] = "class-" + (text.Length > 0 && !(text.Equals(" "))).ToString();
            }
        }
    })
    .Pageable(paging => paging.Total(Model.TotalRecords).PageSize((int)ViewData["PageSize"]))
    .Sortable()
    .Render(); 
 %>

11 Answers, 1 is accepted

Sort by
0
Paul Hoeffer
Top achievements
Rank 1
answered on 23 Nov 2010, 11:20 PM
I'm seeing the same issue.  Any ideas on how to resolve?
0
Atanas Korchev
Telerik team
answered on 24 Nov 2010, 08:27 AM
Hi,

 Do you use script combination? If yes - this might be due to a bug which we recently fixed. I am attaching the hotfix build so you can try it out.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Paul Hoeffer
Top achievements
Rank 1
answered on 24 Nov 2010, 06:24 PM
I tried the hotfix but am still getting an error here:

jQuery(document).ready(

 

function(){

 

jQuery(

 

'#Menu').tMenu();  // <-- THIS LINE

 


The Site.Master makes this reference, which if removed makes the error go away.  Naturally we need this line of code to work.

<

 

 

div><% Html.RenderPartial("Menu", ViewData["MenuItems"]); %></div>

 


Here is the combination line at the bottom fo Site.Master

<%

 

= Html.Telerik().ScriptRegistrar().DefaultGroup(group => group.Combined(true).Compress(true)) %>

Not sure where to go from here, e.g. is this a differnet issue, did I miss a step in applying the hotfix, etc.

 

0
Paul Hoeffer
Top achievements
Rank 1
answered on 24 Nov 2010, 07:11 PM
FWIW, if I step in to the code it jumps to the jquery-1.4.3.min.js file on the line

i===

 

true&&b.readyWait--;

 

0
Paul Hoeffer
Top achievements
Rank 1
answered on 24 Nov 2010, 08:00 PM
OK, I did the old standby of changing one thing, test.  Change another.  Test.

What I found was that it has to do with the updated Telerik.Web.Mvc.dll that you provided in the Hotfix, e.g....

If I revert to the one from Q3 2010 then the hotfix works just fine and the original error goes away. 

Using the .dll that you supplied in the Hotfix while fixing the old js error, causes a new one.

EDIT!!
However...the orginal problem still remains when I go back to the older .dll, but is fixed on the new.

So, it seems I can use the new .dll which causes every page to throw an error, or the old .dll which just makes some pages have the error. :(
0
Atanas Korchev
Telerik team
answered on 25 Nov 2010, 08:14 AM
Hi Paul Hoeffer,

This could be due to a known jquery 1.4.3 issue. You can try using the newly released jquery 1.4.4 which addresses it. To do so try this:

<script src="path_to/jquery-1.4.4.min.js" ></script>
<%= Html.Telerik().ScriptRegistrar().jQuery(false) %>

Does the bug go away if you disable asset combination? In any it would be great if you manage to send us a sample project which fails in the same way. We will troubleshoot it and find where the problem is.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Paul Hoeffer
Top achievements
Rank 1
answered on 10 Dec 2010, 02:08 AM
We have upgraded to use jquery1.4.4 and have the same issue.  Currently we are using the Q3 .dll instead of the hotfix .dll though we're using the 1123 css files.

We are also using
<%= Html.Telerik().ScriptRegistrar().jQuery(false) %>
As you recommend.

If we try to reference the hotfix .dll we get the error I described before, e..g at line

jQuery(document).ready(function(){ 
jQuery('#Menu').tMenu();  // <-- THIS LINE 

Not sure what you refer to as asset combination?
0
Rosen
Telerik team
answered on 10 Dec 2010, 08:26 AM
Hello Paul,

 I'm afraid that in order to further investigate your case, I will need to ask you to provide a small runnable project in which the described behavior can be observed. This way we will be able to get better understanding about your scenario and be able to provide you with a more detailed answer.

Greetings,
Rosen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Paul Hoeffer
Top achievements
Rank 1
answered on 10 Dec 2010, 07:51 PM
I have your repro!

This only happens when we have dynamically generated columns.  Typically when using the Telerik control in a grid, one passes up a model and the properties being in C# have no spaces at all.

However since we're binding to a DataTable the "properties" are column names.  Column names can certainly have spaces in them. 

I did a check and this *only* happens when there is a space in a column name.  Taking out the spaces and BOOM! the error goes away.

So, the fix that you need to do is up update the telerik.grid.min.js file to handle the case where the member name may have a space.

This is why the js fails - you're doing concatonation and the space in the member name is breaking your code:

return new Function("data","return data"+(f.member?"."+f.member:"")+";")

Becomes with a column name of "My Column"
return new Function("data","return data.My Column;")

Which of course breaks.
0
Rosen
Telerik team
answered on 13 Dec 2010, 11:08 AM
Hi Paul,

Indeed, current version of grid component does not support member names which contains spaces.
Generally speaking, handling updates on fields with spaces will be a bit tricky and inconvenient, as the default binders will not be able to binding the posted values to the action's parameters, thus one should extract the values from the form's  posted values collection manually. Therefore, I suggest you to consider changing the member names, if appropriate to your scenario.

All the best,
Rosen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Paul Hoeffer
Top achievements
Rank 1
answered on 13 Dec 2010, 09:26 PM
This is what we've done.  I suspect it would be good of Telerik to include this issue in release notes or similar.
Tags
Grid
Asked by
Anthoni
Top achievements
Rank 1
Answers by
Paul Hoeffer
Top achievements
Rank 1
Atanas Korchev
Telerik team
Rosen
Telerik team
Share this question
or