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
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
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.
i===
true&&b.readyWait--;
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. :(
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) %>
Regards,
Atanas Korchev
the Telerik team
We are also using
<%= Html.Telerik().ScriptRegistrar().jQuery(false) %>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?
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
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.
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.
Rosen
the Telerik team