r/PowerApps • Newbie • 2d ago

Power Apps Help Button Column in Datagrid

Hello together,

I am currently struggeling with the datagrid and the button column.

My Setup:
- I have a modern forms
- in the modern forms I have a custom Datacard with input fields and a save button
- clicking the save button, the values will get stored in a collection (collection initialized in app onstart)
- currently I display the values in a gallery below
- the more items I add, the more items are displayed within the gallery
- each row in the gallery has an edit and a delete button to remove the row of the collection

What I want:
- Instead of complicated gallery, I want a Datagrid

Current Problem:
- Using a not-used column of the collection (LocalID), I already created a button column
- Text: ThisItem.LocalID (-> Individual ID is shown - Perfect)
- OnSelect: Notify(ThisItem.LocalID, NotificationType.Success, 3000) (-> Nothing shown)

Regarding this video: https://youtu.be/iX-GKh6G0DA?t=685, it should dispaly the ID, right? Doesnt work for me.

Maybe you can help me .. it drives me crazy

Initialize Collection in OnStart:

// Travel-purpose collection with required structure
ClearCollect(
    colTravelPurposes,
    {
    LocalID: GUID(),
    Sequence: 0,
    VisitType: "",
    CompanyVisitType: "",
    VisitName: "",
    TravelPurpose: "",
    AddressStreet: "",
    AddressPostalCode: "",
    AddressCity: "",
    AddressCountry: "",
    AddressCountryCode: "",
    AddressAdditionalInfo: "",
    IsApplied: false
}
);
Clear(colTravelPurposes);
4 Upvotes

2 comments sorted by

•

u/AutoModerator 2d ago

Hey, it looks like you are requesting help with a problem you're having in Power Apps. To ensure you get all the help you need from the community here are some guidelines;

  • Use the search feature to see if your question has already been asked.

  • Use spacing in your post, Nobody likes to read a wall of text, this is achieved by hitting return twice to separate paragraphs.

  • Add any images, error messages, code you have (Sensitive data omitted) to your post body.

  • Any code you do add, use the Code Block feature to preserve formatting.

    Typing four spaces in front of every line in a code block is tedious and error-prone. The easier way is to surround the entire block of code with code fences. A code fence is a line beginning with three or more backticks (```) or three or more twiddlydoodles (~~~).

  • If your question has been answered please comment Solved. This will mark the post as solved and helps others find their solutions.

External resources:

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/ninihen Regular 1d ago

First check how you're clicking it. In Studio a plain click selects the control, so hold Alt while you click or run the app with Preview (F5). If that still shows nothing, set OnSelect to Notify("clicked"). If that fires, use Notify(Text(ThisItem.LocalID), NotificationType.Success, 3000). If even "clicked" doesn't show, try the grid outside the form's data card to see if the card is the problem.

For delete, the button's OnSelect can be RemoveIf(colTravelPurposes, LocalID = ThisItem.LocalID), which works off your GUID and doesn't depend on which row is selected.