Kendo listview with collapse and expand function

1 Answer 209 Views
ListView
Enrico
Top achievements
Rank 1
Enrico asked on 24 Jan 2023, 05:34 AM
how can I add a expand and collapse button for every grouping in kendo listview?

1 Answer, 1 is accepted

Sort by
1
Accepted
Georgi Denchev
Telerik team
answered on 26 Jan 2023, 12:24 PM

Hi, Enrico,

The ListView doesn't have a built-in functionality for expanding/collapsing, however you could initialize a Kendo PanelBar over its content to achieve the desired effect.

          let ls = $("#listView").kendoListView({
            dataSource: dataSource,
            template: kendo.template($("#template").html())
          }).data("kendoListView");

          ls.content.kendoPanelBar({
            expand: function(e) {
              $(e.item).find(".cards").css("display", "flex");
            },
            collapse: function(e) {
              $(e.item).find(">span").removeClass("k-selected");
            }
          });

Dojo

https://dojo.telerik.com/@gdenchev/UkETAZov 

Best Regards,
Georgi Denchev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
ListView
Asked by
Enrico
Top achievements
Rank 1
Answers by
Georgi Denchev
Telerik team
Share this question
or