cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
shadowfox
Frequent Visitor

Issue with multiple same controls on same form

I'm having an issue with having multiple instances of the same control on the form. I have them setup in different sections/tabs and on initial load - both are fine. But when I switch back from the second control to the first tab I get the odd behavior.

The first updateView call everything works good. But then I get the second updateView call and it contains data from the second instance - including the context.parameters. I'm not sure how to stop this behavior as it's overriding my data. What's really odd is the dataset doesn't change (it still shows the correct dataset). What I'm trying to do is render a custom button on a grid and the text for the button is flipping to the second tab's text on the first tab after that second updateView.

 

I hope that makes sense. Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
cchannon
Super User
Super User

So this is probably because the namespace of your controls are the same so they're stepping on each other WRT the definition of "this" and your variables are cross-pollinating.

 

Storing at least some values at the namespace level is probably inescapable, such as "container" and "notifyOutputChanged" but if I were you I would look through the code and try to scope everything possible to within a function declaration. This will help prevent them from stepping on each other.

View solution in original post

2 REPLIES 2
cchannon
Super User
Super User

So this is probably because the namespace of your controls are the same so they're stepping on each other WRT the definition of "this" and your variables are cross-pollinating.

 

Storing at least some values at the namespace level is probably inescapable, such as "container" and "notifyOutputChanged" but if I were you I would look through the code and try to scope everything possible to within a function declaration. This will help prevent them from stepping on each other.

@cchannon you were correct, thank you for your help! Had to refactor the code but was able to get it working. 

Helpful resources

Announcements
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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,615)