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

Ajax Binding doesn't work (Cannot use 'in' operator to search for 'HasSubgroups')

5 Answers 106 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Keivan Beigi
Top achievements
Rank 1
Keivan Beigi asked on 02 Oct 2010, 08:55 PM

When I try to bind a grid using ajax, I get the wait icon spinning. It doesn't stop and no data is shows. fiddler shows that the data was sent to the client.
HTTP/1.1 200 OK
Server: Cassini/4.0.1.8
Date: Sat, 02 Oct 2010 19:47:30 GMT
X-AspNet-Version: 4.0.30319
X-AspNetMvc-Version: 2.0
Cache-Control: private
Content-Type: application/json; charset=utf-8
Content-Length: 44
Connection: Close
 
{"data":["adaw","awdadw","awdad"],"total":3}


looking at inspect section of Chrome shows this error.

Uncaught TypeError: Cannot use 'in' operator to search for 'HasSubgroups' in adaw
a.grid.bindTotelerik.grid.min.js:1
a.grid.dataBindtelerik.grid.min.js:1
a.grid.ajaxOptions.e.successtelerik.grid.min.js:1
c.extend.proxy.bjquery-1.4.2.min.js:32
bjquery-1.4.2.min.js:124
c.extend.ajax.g.x.onreadystatechangejquery-1.4.2.min.js:129


Html.Telerik().Grid<String>(Model).Name("UnmappedGrid").
    Columns(columns => columns.Bound(o => o).Title("Folder"))
    .Sortable(sort => sort.OrderBy(order => order.Add(o => o).Ascending()).Enabled(false))
    .DataBinding(dataBinding => dataBinding.Ajax().Select("_ajaxUnmapped", "Series"))
    .Render();

[GridAction]
public ActionResult _ajaxUnmapped()
{
    return View(new GridModel<String>
    {
        Data = new List<String> { "adaw", "awdadw", "awdad" }
    });
}

5 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 04 Oct 2010, 07:22 AM
Hello Keivan Beigi,

 The result which you return is not supported by the grid. Please check the ajax binding help topic or the online example which show how to properly configure the grid for ajax binding.

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
Keivan Beigi
Top achievements
Rank 1
answered on 04 Oct 2010, 08:02 AM
Thanks for the response Athanes. I have read the Ajax guide a few a times and my code is exactly from the demo site. As you can see the data I'm returning is simply an array of strings. Would you be able to give me a bit of more hints. Is it the binding that is wrong? Is it the model? am I missing an step somewhere?
0
Atanas Korchev
Telerik team
answered on 04 Oct 2010, 09:26 AM
Hi Keivan Beigi,

 I investigated the case thoroughly and found that the grid currently cannot bind to array of primitive objects (string, number etc). I fixed that problem and I am attaching the updated JavaScript file. Replace the original telerik.grid.min.js with the one attached.

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
Keivan Beigi
Top achievements
Rank 1
answered on 04 Oct 2010, 05:05 PM
Thanks a lot, is this fix something that will be included in the next release? if not i rather change the model rather than having to maintain a custom version of the script file.


Thanks,
0
Jon Smith
Top achievements
Rank 1
answered on 20 Apr 2011, 08:21 PM
Hi,

I too am trying to bind to a list of primitive objects, in this case strings. Can I check whether the fix given here is in the latest release of the MVC code?

Thanks
Tags
General Discussions
Asked by
Keivan Beigi
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Keivan Beigi
Top achievements
Rank 1
Jon Smith
Top achievements
Rank 1
Share this question
or