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

Grouping in a ListView

3 Answers 177 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Toby
Top achievements
Rank 1
Toby asked on 13 Jun 2013, 03:59 PM

Hi,
What is the best way to group by a field in a ListView?
I'd like to have something along the lines of this

Species: Human
1: Toby
2: Rob
Species: Dog
3: Harry
4: Rover
Species: Cat
5: Tickles

The model schema is as below
ID  Name  Species
1  Toby  Human
2  Rob  Human
3  Harry  Dog
4  Rover  Dog
5  Tickles  Cat

<script type="text/x-kendo-tmpl" id="template">
    <div class="person">
        <div class="id">#:ID#</div>
        <div class="name">#:Name#</div>
    </div>
</script>
 
<div id="persons">
    
    @(Html.Kendo().ListView<Person>()
    .Name("persons")
    .TagName("div")
    .ClientTemplateId("template")
    .DataSource(ds => ds
        .Model(m => m.Id(p => p.ID))
        .Read(r => r.Action("PersonsRead", "Home"))
        .Group(g => g.Add(p => p.Species))
        )
)

I managed to get as far as the above, but this throws an error as it is passing the Species field and value to the client template from the Group method.
Any ideas?

3 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 14 Jun 2013, 06:36 AM
Hello Toby,

I'm afraid that the ListView widget doesn't support binding to grouped DataSource.

Regards,
Nikolay Rusev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Paul
Top achievements
Rank 1
answered on 04 May 2015, 04:25 PM

Is this still unimplemented? I do notice that the MobileListView does allow this: http://demos.telerik.com/kendo-ui/mobile-listview/templates

 Looking to do this in the ListView though - no mobile desired. 

0
Nikolay Rusev
Telerik team
answered on 07 May 2015, 06:04 AM

Hello Paul,

The Web ListView doesn't support grouping yet. You can submit this as a feature request on UserVoice, so that it is considered for implementation in a future release.

Regards,
Nikolay Rusev
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
ListView
Asked by
Toby
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Paul
Top achievements
Rank 1
Share this question
or