Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actions OnDrop, OnChange, and OnAction Not Working as Expected #84

Open
RAKSHAKAR opened this issue Aug 24, 2024 · 6 comments
Open

Actions OnDrop, OnChange, and OnAction Not Working as Expected #84

RAKSHAKAR opened this issue Aug 24, 2024 · 6 comments

Comments

@RAKSHAKAR
Copy link

RAKSHAKAR commented Aug 24, 2024

@scottdurow,
Good Day!
An ItemId is present for all the records, but I am unable to retrieve it using the function Self.Selected.ItemId, as it results in an error. This appears to be a bug in the component, and I need your immediate attention to resolve this issue as it is critical to my project's delivery.

Description:
I am encountering issues with the OnDrop, OnChange, and OnAction actions in Power Apps. Specifically, the Self.Selected.ItemId or Self.Selected.id value returns as blank when using the OnDrop action. This behavior occurs consistently across all actions. Please check the attached image ItemId is there but it is not populating with Self fx.

Steps to Reproduce:

  1. Implement the OnDrop action on a control that supports drag-and-drop functionality.
  2. Try to access Self.Selected.ItemId or Self.Selected.id within the OnDrop action.
  3. Observe that the ItemId value is blank.
  4. Similarly, use the OnChange and OnAction actions on relevant controls and observe unexpected behavior.

Expected Behavior:

The Self.Selected.ItemId or Self.Selected.id should return the correct ItemId or id of the selected item when triggered by the OnDrop action. The OnChange and OnAction actions should also work as expected, responding to their respective triggers without issues.

Actual Behavior:

  • Self.Selected.ItemId returns a blank value during the OnDrop action.
  • The OnChange and OnAction actions are not functioning as expected.

Note:

I am working on a live application and using your component. I am urgently seeking a solution as this issue is delaying my project delivery.

Additional Information:

I understand that the OnDrop action is supposed to trigger when an item is dragged and dropped. Please clarify the intended use of the OnChange and OnAction actions with a small sample.

image

@RAKSHAKAR
Copy link
Author

An ItemId is present for all the records, but I am unable to retrieve it using the function Self.Selected.ItemId as it results in an error.

@RAKSHAKAR
Copy link
Author

RAKSHAKAR commented Aug 26, 2024

I have created the below design and want to make the edit and delete buttons functional. how we could do it. An Output of HTML content is also not showing properly.
image
image

@Un-Genius
Copy link

I have the same issue where I expect a way to reference it's own variables rather than having to loop through all items.

Here's my temporary fix for everyone else. I'm using the OnAction event and a button:

  1. Put the ID into the Button action reference.
<button class=""action-{{ID}}</button>
  1. Loop through all of the items in the gallery. Filter based on that same ID. You then know exactly which record you are referencing.
// Find the item with the matching ID
Set(
    selectedItem,
    First(Filter(dynamicMedia, ThisRecord.ID = pcf_media.ActionItemId))
);

// Setup Form Table
Set(
    dynamicForm,
    {
        ID: selectedItem.ID,
        Title: selectedItem.Title
    }
);

@RAKSHAKAR
Copy link
Author

@Un-Genius Many Thanks for your reply.
Could you please suggest a solution for an Output of HTML content?

@Ricardo-Manzanares
Copy link

Ricardo-Manzanares commented Oct 8, 2024

I have the same issue where I expect a way to reference it's own variables rather than having to loop through all items.

Here's my temporary fix for everyone else. I'm using the OnAction event and a button:

  1. Put the ID into the Button action reference.
<button class=""action-{{ID}}</button>
  1. Loop through all of the items in the gallery. Filter based on that same ID. You then know exactly which record you are referencing.
// Find the item with the matching ID
Set(
    selectedItem,
    First(Filter(dynamicMedia, ThisRecord.ID = pcf_media.ActionItemId))
);

// Setup Form Table
Set(
    dynamicForm,
    {
        ID: selectedItem.ID,
        Title: selectedItem.Title
    }
);

The ActionItemId property name in the action receives the value set in HTML after: action-

Example: <button class="action-{{RecordId}}"... The action receives the GUID of the record.

Only in OnAction, in OnDrop not working.

And affirm that only the action class works with HTML button control and not others as indicated in the Actions section of the documentation @scottdurow.

Example of what doesn't work : <img class="action-{{RecordId}}" src="https://cdn-icons-png.flaticon.com/512/622/622669.png" style="z-index: 0;" width="24" height="24"

@RAKSHAKAR
Copy link
Author

I believe it should be redesign using modern controls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants