web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Data Cards not alignin...
Power Apps
Unanswered

Data Cards not aligning when others are hidden

(0) ShareShare
ReportReport
Posted on by 175

Hi all.

 

I need to be able to hide certain datacards in a form depending on the value of a dropdown. No problems doing that.

 

However, I want all empty spaces to be filled when cards are hidden. This is not happening for me when I have more than one column in the form. See image attached.

Categories:
I have the same question (0)
  • BrianS Profile Picture
    2,407 Super User 2024 Season 1 on at

    You could try setting the X and Y locations of the various data cards with variables and using If statements to determine their location. The whole layout/datacard part of Powerapps is cludgy - very hit and miss. You may have better luck not using a form and laying out the screen manually. It will mean you need to use Patch instead of SubmitForm, but the layout will be much easier. All the objects can be related to others for location and they will actually use the locations rather than a form that has some other secret sauce acting behind the scenes to mess things up. Just set the X of card 3 to something like If( textinput2.Visible=true, textinput2.X +textinput2.width+5, textinput1.X +textinput1.width+5). You can create your first 2 inputs and then you should be able to copy and paste that to create the rest and just change your numbers. It often takes less time than playing with the form. Especially as if yo decide to add a field to a form all the previous work you did will dissapear.

  • barrymac20 Profile Picture
    175 on at

    I seem to recall that this wasn't an issue up until recently. Sometimes the cards pop into the correct position and sometimes they don't.

    I could go the non-form route but I've already gone too far down a road that it would take forever to roll back.

    I'm hoping someone can help regarding a fix for the form.

     

  • Verified answer
    BrianS Profile Picture
    2,407 Super User 2024 Season 1 on at

    That could be the case, but I have always fought with it. The one thing that may help is the "absolute-relative" positioning of the cards. I don't remember where it is documented, but the form is arranged in an array with the slot in the upper left being 0,0.

    If you work with the palette on the right of the interface - not the attributes in the ribbon at the top, you can set those numbers in the x and y values and they will "snap" to those positions. ie - if you put in x=1, y=2 for a card it will be in the 3rd row down and the second column. If the datacard that has x=0,y=2 is hidden, it will move into that position.

    You can also add datacards to act as spacers to keep the reshuffling from moving too far.

  • barrymac20 Profile Picture
    175 on at

     

    Works perfect when i format the form with only one column. Everything slides into place nicely. But the multi column form is a not playing nice!

    I'll have a play with the array values and report back.

  • barrymac20 Profile Picture
    175 on at

    So having spent a bit of time with the X and Y numbers I can see whats happening when I hide cards.

     

    I have 3 columns so X's of 0, 1 & 2. If I hide a card in the X=0, Y=0 position the cards in 1,0 & 2,0 move to 0,0 and 1,0 position as you suggested they would. But the card in X=1, Y=0 position doesn't move up into X=2, Y=1 as you'd expect.

     

    So when I hide the various cards any of the ones remaining in the same row move left but the ones below don't move up. That's why I'm left with the gaps to the right in my image.

  • BrianS Profile Picture
    2,407 Super User 2024 Season 1 on at

    I played around a little with replacing the X & Y values with variables and switching them out with dropdowns. It appears that functions the same as putting numbers in the palette. So it should be possible to write some If statements to get things where you want them. Depending on how complicated your layouts are they may be very creative IF statements though. 

    If you have a limited number of layouts you need it may be easier to build them as different forms and then swap out the visibility on the entire form.

  • barrymac20 Profile Picture
    175 on at

    I'll have a play with variables to see if I can get them to change rows accordingly. It's very frustrating when things don't work as you'd expect!

  • barrymac20 Profile Picture
    175 on at

    OK. I have this working now using the same variables that drive the visibility and If statements.

     

    Its a solution but not really a desirable one considering its a work around.

     

    In this case should I marked Solved?

  • brian704 Profile Picture
    4 on at

    Glad it is working. It is very frustrating to work with the form screen sometimes. 

    If you could mark it solved that would be great

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard