Grouping in a ListView

4 posts, 0 answers
  1. Toby
    Toby avatar
    20 posts
    Member since:
    Nov 2010

    Posted 13 Jun 2013 Link to this post

    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?

  2. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2284 posts

    Posted 14 Jun 2013 Link to this post

    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!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Paul
    Paul avatar
    102 posts
    Member since:
    Jun 2010

    Posted 04 May 2015 in reply to Nikolay Rusev Link to this post

    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. 

  5. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2284 posts

    Posted 07 May 2015 Link to this post

    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.

     
Back to Top
UI for ASP.NET MVC is VS 2017 Ready