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

ASP.NET MVC 4 Grid State grouping issue

4 Answers 44 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anas
Top achievements
Rank 1
Anas asked on 22 Nov 2013, 09:31 AM
Hi

I have a issue while trying save the grid state and loading it back if grouping is there "Uncaught TypeError: Cannot read property 'length' of undefined "

Steps to reproduce
1. Go to Products link in home page.
2. Group with any column in the grid (which will save the state to local storage).
3. refresh the page (this gives the error mentioned above in developer options console).

Please provide a suitable resolution for the same.

Note: I have attached the sample project (aspnetmvc-episode3.zip)

Regards
Anas

4 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 25 Nov 2013, 09:27 AM
Hello Anas,

I posted my reply in the support ticket that you have opened with the same question. For convenience, I am pasting it below:

You should use the autoBind option to prevent the initial binding when using this approach e.g.
Html.Kendo().Grid<Product>()
    .Name("Products")
    .AutoBind(false)
Otherwise, the initial request will still be made and an error will be thrown when there are groups but not grouped data is returned from the server.


Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Tonny
Top achievements
Rank 1
answered on 17 Jan 2014, 12:21 AM
Hi Daniel,

I tried the attached sample project with your recommendation to set auto binding to false but it still does not work. Whenever I drop a column to the head for grouping the error occurred.

I actually could not make this grouping feature working at all.

Using this sample project, I updated a little bit to remove the event but just add group  as following code

@(Html.Kendo().Grid<

 

Product>()

.Name(

 

"Products").Columns(c => {

c.Bound(p => p.Name);

c.Bound(p => p.Supplier.Name).Title(

 

"Supplier");

c.Bound(p => p.Category.Name).Title(

 

"Category");

c.Bound(p => p.UnitPrice).Format(

 

"{0:c}");

c.Bound(p => p.UnitsInStock);

c.Bound(p => p.Discontinued);

})

.DataSource(d => d

.Ajax()

.Read(r => r.Action(

 

"Get", "Products"))

.PageSize(5)

.Group(p=>p.Add(t=>t.Name))

)

.Pageable()

.Groupable()

.Sortable()

.Filterable()

 

//.Events(e => e.DataBound("SaveLayout"))

)



This does not work at all. As long as I run this, it has the exception saying Unable to get value of the property 'length' (please see attached files for detail). I also opened a ticket for you 777459

Can you please let me know how could I make the grouping feature working?

Thanks,
Tonny


0
Haluk
Top achievements
Rank 1
answered on 18 Mar 2014, 02:10 PM
Can you help me on this post 

http://www.telerik.com/forums/telerik-mvc-grid-row-values-failing-after-group-by
0
Daniel
Telerik team
answered on 20 Mar 2014, 02:15 PM
Hello Haluk,

The topic of this thread differs from the one that you provided. Please post any additional questions that you may have on that topic there. 

Regards,
Daniel
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
Grid
Asked by
Anas
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Tonny
Top achievements
Rank 1
Haluk
Top achievements
Rank 1
Share this question
or