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

    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 id="persons">
        .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
    Nikolay Rusev avatar
    2287 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.

    Nikolay Rusev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Paul
    Paul avatar
    105 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:

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

  4. Nikolay Rusev
    Nikolay Rusev avatar
    2287 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.

    Nikolay Rusev

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

Back to Top