cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sudosaurus
Post Prodigy
Post Prodigy

Button in gallery to open new screen

Hello,


In my app I have this gallery on my home screen with the items value set to "colGalleryMenu".
sudosaurus_0-1657013347383.png
In the App/OnStart value I have this set to the below where the "view/eye" symbol takes the user to the applicable form. 

Set(
    clTheme,{
        clBlue: BlueSquare.Fill,
        clDarkBlue: DarkBlueSquare.Fill,
        clRed: RedSquare.Fill,
        clYellow: YellowSquare.Fill,
        clWhite: WhiteSquare.Fill,
        clGreen: GreenSquare.Fill
    }
);

Set(
    ftTheme,FontLabel.Font
);
ClearCollect(
colGalleryMenu,
{
MenuTitle: "Extra Care Application to keep a mobility scooter",
NavigateTo: ECAKMS_scrn
},
{
MenuTitle: "Extra Care Centra New Resident",
NavigateTo: ECCNR_scrn
},
{
MenuTitle: "Extra Care Person Centered Fire Risk Assessment",
NavigateTo: ECPCFRA_scrn
},
{
MenuTitle: "Extra Care Personal Emergency Evacuation Management Plan",
NavigateTo: ECOEEMP_scrn
},
{
MenuTitle: "Older Persons Support Agreement",
NavigateTo: OPSA_scrn
},
{
MenuTitle: "Supported Housing Move Out Checklist",
NavigateTo: SHMOC_scrn
},
{MenuTitle: "Support Plan Needs Assessment",
NavigateTo: SPNA_scrn
},
{MenuTitle: "Supported Housing Risk Assessment and Management Review",
NavigateTo: SHRAAMR_scrn
},
{MenuTitle: "Support Plan",
NavigateTo: SP_scrn
}
);


What I'd like to do is allow a user to navigate to a new SharePoint list item (screen) for each item by clicking on the "+" smybol - could I integrate this into the above code?

1 ACCEPTED SOLUTION

Accepted Solutions

You can use the same logic as in my original reply: just add another item to the record, where the value is the screen you want the user to navigate to. 

For example: 

{
MenuTitle: "Extra Care Application to keep a mobility scooter",
NavigateTo: ECAKMS_scrn,
NavigateToNew: some_scrn
}

then use ThisItem.some_scrn in your Icon's onSelect.

View solution in original post

10 REPLIES 10
Aapok
Resolver II
Resolver II

Assuming your NavigateTo: record is a reference to another screen in your app,

 

On the OnSelect property of your + icon, you can try:

 

Navigate(ThisItem.NavigateTo);

 

 

sudosaurus
Post Prodigy
Post Prodigy

@Aapok the Navigation takes the user to a list gallery of each form - there is then a + button on that screen which takes the user to another screen which contains the sharepoint list item where they can fill out a new form.

 

So essentially from the chooser I wish for the user to be able to click the "+" button on the home screen list and take them to the required form screen to start filling out rather than going to the list view screen first.

You can use the same logic as in my original reply: just add another item to the record, where the value is the screen you want the user to navigate to. 

For example: 

{
MenuTitle: "Extra Care Application to keep a mobility scooter",
NavigateTo: ECAKMS_scrn,
NavigateToNew: some_scrn
}

then use ThisItem.some_scrn in your Icon's onSelect.

sudosaurus
Post Prodigy
Post Prodigy

@Aapok 

 

The trouble with this is that I can only put one item into the onSelect property of my gallery

So I wouldn't be able to apply onSelect properies for each row.

sudosaurus_0-1657023731859.png

 

Instead of onSelect property of your gallery, I assumed you were using the onSelect property of your 'eye/view' icon for navigating to the applicable form, as your first post would imply. If you move the code from the onSelect of the gallery to the onSelect of the 'eye/view' icon, you can then add the code I suggested to the + icon's onSelect. This will stop redirecting the user when selecting the title though.

I doubt it is possible to have the first navigation in the gallery.onSelect while having a different functionality in the + icon, but I'm not sure about that. I know the example I provided earlier works because I have used a similar functionality before.

 

Edit: I just did a little testing and you can achieve the functionality with gallery.onSelect if you modify the tabIndex property of your gallery and + icon. For my testing I used tabIndex -1 for the gallery and 1 for the + icon.

WiZey
Solution Supplier
Solution Supplier

The "OnSelect" property of a gallery is replicated on each of its row, there is no need to try and edit all the rows because the first one is already used as a model for the whole list.

 

Also, the "OnSelect" of the gallery is called by its selected content if said content's property "OnSelect" use the function "Select(parent)" or another similar call. I don't think it's necessary to tinker with the control's "TabIndex" property.

 

@sudosaurus Have you tried applying @Aapok idea of inserting "Navigate(ThisItem.NavigateTo)" inside one or another control's "OnSelect" property? If the result doesn't satisfy you, could you further elaborate on your aim?

Hi @sudosaurus,

The Gallery OnSelect: property is just a convenient catchall that assumes all your gallery items will do something similar.  All the objects you add to your gallery have their OnSelect: property set to Select(Parent) by default, which means they all run the Gallery OnSelect: property when clicked.

You can continue to use the Gallery OnSelect: property by building in logic that changes depending on the selected gallery item, but this still carries one action for any number of potential objects that could be clicked in a row.

I haven't tried @Aapok's tabindex example (and I'd like to see it @Aapok - can you share more?) but a simpler method might be to just set the Gallery OnSelect: to false and setup OnSelect: behaviour for each of the icons in your gallery row by replacing Select(Parent) with your own instructions.

  

For example, reiterating what @Aapok suggested, add another navigation field to each form entry  in colGalleryMenu, replace the Gallery OnSelect: property with false and then set the eye icon OnSelect: property to

Navigate(ThisItem.NavigateTo)

 and set the + icon OnSelect: property to

Navigate(ThisItem.NavigateToNew)

 Hope this makes sense,

RT

Sure, the way I tested it:

I created a collection with two different links like so:

 

Set(a,Sequence(5, 1));
ForAll(a, Collect(b, {title: "Screen2", link: Screen2, link2: Screen3}));
Collect(b, {title: "diff", link: Screen3, link2: Screen2 });

I didn't feel like typing out a larger list with different links, but still wanted to test with more than one gallery item. I also added an extra item after the ForAll just to make sure ThisItem works correctly in Gallery.OnSelect.

 

I added a gallery a blank flexible height gallery, set the Items property to b.

I added a Label to the gallery with ThisItem.Title as it's text property, and an Icon with Navigate(ThisItem.link) as the OnSelect of the Icon. 

I edited the TabIndex of my Icon to 1 (from the default -1).

I then added Navigate(ThisItem.link2) to Gallery.OnSelect.

 

With this setup, if you click anywhere on the gallery item other than the Icon with TabIndex of 1, you will navigate to ThisItem.link2. 

If you click on the Icon with TabIndex of 1, you will navigate to ThisItem.link

 

Hopefully you could understand my solution despite bad naming policies, as it was a test I threw together very quickly just to test the idea I had.

sudosaurus
Post Prodigy
Post Prodigy

Thanks @Aapok - your solution is working as expected - it appeared I needed to take a lunch break to re-gather my thoughts - all makes sense now! 😉

@RusselThomas thanks for the clarification - super helpful!!

 

Thanks @WiZey for your contribution also! 👍

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (3,273)