web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Apps
Answered

Drop down gallery

(0) ShareShare
ReportReport
Posted on by

Good day,
I have such an application

I am trying to make such a drop-down menu that I click on a button and a table is displayed

Currently, it works for me only after I click on the button, the table appears, I click on the second button and the first one closes and a new one opens, and I would need to modify it so that when I click on the button, the table appears, I click on the second one and see both tables.

I have two galleries there, in the first there are the buttons that pull their names from sharepoint, the second gallery is nested and it already displays the data itself, also from sharepoint.

AndrejPavlik18_0-1719475267758.png

 

Tu sú kody 

Items of the parent gallery

GroupBy(
    SortByColumns(
        AddColumns(
            'Best Practice Ideas';
            'New colum';
            'Sub process'.Value
        );
        "New colum";
        SortOrder.Ascending
    );
    'New colum';
    Data
)
 
On Selected parent gallery button 
Select(Parent)
 
Text on this button 
ThisItem.'New colum' & " " & If(ThisItem.IsSelected ; CountRows(Gallery7.AllItems))
 
 
Items of the nested gallery
Switch (
    varSortColumn;
    "Ideadescription";
    SortByColumns(
        Filter(
            ThisItem.Data;
            StartsWith(
                'Idea description';
                TextInput1.Text
            );
            (Plant.Value = ComboBox1.Selected.Value || ComboBox1.Selected.Value = Blank());
            (ComboBox1_1.Selected.DisplayName = Blank() || Author.DisplayName = ComboBox1_1.Selected.DisplayName);
            (Created >= DatePickerCanvas1.SelectedDate)
           
        );
        "Ideadescription";
        If(
            varSortColumn = SortOrder.Ascending;
            SortOrder.Ascending;
            SortOrder.Descending
        )
    );
    "Created";
    SortByColumns(
        Filter(
            ThisItem.Data;
            StartsWith(
                'Idea description';
                TextInput1.Text
            );
            (Plant.Value = ComboBox1.Selected.Value || ComboBox1.Selected.Value = Blank());
            (ComboBox1_1.Selected.DisplayName = Blank() || Author.DisplayName = ComboBox1_1.Selected.DisplayName);
            (Created >= DatePickerCanvas1.SelectedDate)

        );
        "Created";
        If(
            varSortColumn = SortOrder.Ascending;
            SortOrder.Ascending;
            SortOrder.Descending
        )
    )
)
 
On Selected on nested gallery 
Set(mgrVarID; ThisItem.ID) And Set(varShowForm;true)
 
Can you help me with that 🙂
Categories:
I have the same question (0)
  • Verified answer
    anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at

    hi @AndrejPavlik18 ,

    First, initialize an empty collection in your OnStart property of the app:

     

    ClearCollect(colExpandedGroups, {GroupName: "", IsVisible: false});

     

    Update the OnSelect property to toggle the visibility state in the collection:

     

    Set(varGroupName, ThisItem.'New colum');
    If(
     CountRows(Filter(colExpandedGroups, GroupName = varGroupName)) > 0,
     UpdateIf(colExpandedGroups, GroupName = varGroupName, {IsVisible: !LookUp(colExpandedGroups, GroupName = varGroupName).IsVisible}),
     Collect(colExpandedGroups, {GroupName: varGroupName, IsVisible: true})
    );
    Select(Parent);

     

    Set the Visible property of the nested gallery to check the visibility state from the collection:

     

    LookUp(colExpandedGroups, GroupName = ThisItem.'New colum').IsVisible

     

    To ensure that data reloads when the group is expanded or collapsed, you might want to refresh the gallery. You can do this by adding a Refresh action in the OnSelect property:

     

    Set(varGroupName, ThisItem.'New colum');
    If(
     CountRows(Filter(colExpandedGroups, GroupName = varGroupName)) > 0,
     UpdateIf(colExpandedGroups, GroupName = varGroupName, {IsVisible: !LookUp(colExpandedGroups, GroupName = varGroupName).IsVisible}),
     Collect(colExpandedGroups, {GroupName: varGroupName, IsVisible: true})
    );
    Refresh('Best Practice Ideas');
    Select(Parent);

     

    You don't need to change the Items property of the nested gallery, but ensure that it properly filters based on the current group:

     

    Switch (
     varSortColumn;
     "Ideadescription";
     SortByColumns(
     Filter(
     ThisItem.Data;
     StartsWith(
     'Idea description';
     TextInput1.Text
     );
     (Plant.Value = ComboBox1.Selected.Value || ComboBox1.Selected.Value = Blank());
     (ComboBox1_1.Selected.DisplayName = Blank() || Author.DisplayName = ComboBox1_1.Selected.DisplayName);
     (Created >= DatePickerCanvas1.SelectedDate)
     );
     "Ideadescription";
     If(
     varSortColumn = SortOrder.Ascending;
     SortOrder.Ascending;
     SortOrder.Descending
     )
     );
     "Created";
     SortByColumns(
     Filter(
     ThisItem.Data;
     StartsWith(
     'Idea description';
     TextInput1.Text
     );
     (Plant.Value = ComboBox1.Selected.Value || ComboBox1.Selected.Value = Blank());
     (ComboBox1_1.Selected.DisplayName = Blank() || Author.DisplayName = ComboBox1_1.Selected.DisplayName);
     (Created >= DatePickerCanvas1.SelectedDate)
     );
     "Created";
     If(
     varSortColumn = SortOrder.Ascending;
     SortOrder.Ascending;
     SortOrder.Descending
     )
     )
    )

     

    With these changes, clicking on multiple buttons will expand the respective tables without closing the previously opened ones, and you can see multiple tables simultaneously.

     

  • AndrejPavlik18 Profile Picture
    on at

    thanks for your answer 

    But I have one problem in the Items on parent gallery.

    I don't know why I can't use ; at the end of the first line

    I tried to use and it still throws an error

    AndrejPavlik18_0-1719479154536.png

     

  • anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at

    you have to use ;; I guess

  • AndrejPavlik18 Profile Picture
    on at

    Thanks 

    It´s working 🙂 

     

    Have a nice day 🙂

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 490

#2
WarrenBelz Profile Picture

WarrenBelz 427 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 381

Last 30 days Overall leaderboard