cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
james_hathaway
Level: Powered On

Multiple Instances of Components not behaving

I have been trying to use the Component Framework to build a type of "control" that I can reuse, not only in different Apps, but as several instances in the Same App. (Basically - it takes a Table of "Choices", and turns them into a Gallery of buttons, with some added maths/logic to allow for sequential navigation forward ans backward. I mainly use it to turn a "Stage" Choice field in Sharepoint into a type of progress bar - but it's also very handy for creating Tab controls)

 

I have added some Input parameters for things like "BorderRadius", as well as "Items" and an Output Parameter for "Selected".

Within the Component (called ChoiceButtons), there is a Gallery, and within the Gallery Template is a single Button, with the Button Radius parameter set to ChoiceButtons.BorderRadius input parameter.

 

All seems straight forward, and as far as I can tell, exactly how the Microsoft Documentation and tutorials say Components should be made. The problem is that if I add multiple instances of this control to a single App, it seems that the SAME BorderRadius is applied to EVERY instance of the Component. I have one instance with BorderRadius = 0, and another with BorderRadius set to 15. The second instance, however, is displaying square corners. (I have also added quite a few other "styling" Input parameters that are cascaded down to the Button parameters so that I can globally set the Fill color, Font Color, alignment etc of All buttons in the gallery from a single input parameter on the Component)

 

I may have been able to work around this, except the same issue applies to setting the "Items" property of the Custom Component (with the Gallery.Items = Parent.Items). If I try to change the datasource supplied to the second instance of the component, it doesn't matter what I type in, it simply shows the "Items" that the first instance of the component is set to.

 

Is this just a bug of this experimental feature? Or am I doing something wrong?

Would the number of Input parameters have anything to do with why it's not working? (all the styling parameters)

Is it something to do with the fact that I am referencing the input parameters from a control inside a Gallery? (And therefore have to refer to the input parameters by Component Name, and not just through "Parent")?

The only other thing I'm doing different from the simplistic description above, is that I'm adding a column to the input table given in "Items" - the Gallery.Items is actually set to "AddColumns(Parent.Items,"NewColumn",Upper(Value))" - I know I couldn't use a Collection, but is this sort of "in-line collection manipulation" also not supported within Components?

 

Any help would be greatly appreciated...

 

James.

 

 

3 REPLIES 3
Community Support Team
Community Support Team

Re: Multiple Instances of Components not behaving

Hi @james_hathaway ,

Dis you set any property about data source?

Please notice two things:

  • Collections: using Collect within a component is not yet fully supported.
  • Data sources: data sources are not saved with components.

So if you use any formulas about data source or collection in the designing of component, it will become invalid.

You could check this here:

https://powerapps.microsoft.com/en-us/blog/components-available-in-preview/

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
james_hathaway
Level: Powered On

Re: Multiple Instances of Components not behaving

Hi v-yutliu,

 

james_hathaway
Level: Powered On

Re: Multiple Instances of Components not behaving

Just to give you all an update, There is definitely an issue with this implementation of Components.

It would seem that none of my "ChoiceGallery" Component instances correctly apply BorderRadius values to the buttons within the gallery. Some of the instances will correctly show a curved border in the App Studio, but when the App is published, NONE of the components have the BorderRadius that they are set to.

 

Is this because of the fact that I have to reference the actual mMaster) Component Control in the formula for the Button Radii? As a reminder - the structure of my Component is:

 

ChoiceGallery (Component)

    - ButtonGallery (Gallery)

        - Button (BorderRadius = ChoiceGallery.BorderRadius)

 

I have double checked the Microsoft Documentation and a number of "How-To" videos and posts on this subject, and they all say that refering to an input parameter via the "master" component Name is correct - however my experience is that this does NOT work - and all instances of the component just seem to ignore the value given in the input parameter. (Controls that can use the component input parameter using the "Parent" identifier all work fine, but referring to the component control seems to cause issues...)

 

Can someone from Microsoft let me know why this bug is occurring?

Is ther another suggested way to be able to set a control property to an input parameter so that each instance of the component can ge configured independently?

 

Thanks

James.

Helpful resources

Announcements
thirdimage

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors
Users online (6,488)