Hi all,
i created a power app and want to change the sorting for the field on the left - I already tried everything i read online but its just not working. The empty slots from the sharepoint list are at the top which should change to the newest entry at the top:
The coding for the gallery is set up like this if this helps:
- RecordsGallery1:
Control: Gallery
Variant: BrowseLayout_Vertical_ThreeTextVariant_ver5.0
Properties:
OnSelect: =
Default: =CurrentItem
Items: ='Genehmigungen Debitoren'
DelayItemLoading: =true
Fill: =RGBA(250, 250, 250, 1)
Layout: =Layout.Vertical
LayoutMinWidth: =0
LoadingSpinner: =LoadingSpinner.Data
TemplateFill: =If(ThisItem.IsSelected, RGBA(230, 230, 230, 1), RGBA(0, 0, 0, 0))
TemplatePadding: =0
TemplateSize: =104
ZIndex: =1
Children:
- Title1_2:
Control: Label
Properties:
OnSelect: =Select(Parent)
Text: =ThisItem.'Angefordert von'
FontWeight: =If(ThisItem.IsSelected, FontWeight.Semibold, FontWeight.Normal)
Height: =26
PaddingBottom: =0
PaddingLeft: =12
PaddingRight: =0
PaddingTop: =0
Size: =8
VerticalAlign: =VerticalAlign.Top
Width: =196
X: =153
Y: =16
- Title1_1:
Control: Label
Properties:
OnSelect: =Select(Parent)
Text: =ThisItem.Erstellt
FontWeight: =If(ThisItem.IsSelected, FontWeight.Semibold, FontWeight.Normal)
Height: =18
PaddingBottom: =0
PaddingLeft: =12
PaddingRight: =0
PaddingTop: =0
Size: =10
VerticalAlign: =VerticalAlign.Top
Width: =121
X: =197
Y: =67
- Rectangle1:
Control: Rectangle
Properties:
OnSelect: =Select(Parent)
Height: =Parent.TemplateHeight - Separator1.Height
Visible: =ThisItem.IsSelected
Width: =4
- Separator1:
Control: Rectangle
Properties:
OnSelect: =Select(Parent)
Fill: =RGBA(255, 255, 255, 1)
Height: =8
Width: =Parent.TemplateWidth
Y: =Parent.TemplateHeight - Self.Height
- NextArrow1:
Control: Classic/Icon
Variant: ChevronRight
Properties:
OnSelect: =Select(Parent)
AccessibleLabel: =Self.Tooltip
Tooltip: ="Elementdetails anzeigen"
Color: =RGBA(166, 166, 166, 1)
Height: =50
Icon: =Icon.ChevronRight
PaddingBottom: =16
PaddingLeft: =16
PaddingRight: =16
PaddingTop: =16
Width: =50
X: =Parent.TemplateWidth - Self.Width - 12
Y: =(Parent.TemplateHeight / 2) - (Self.Height / 2)
- Body1:
Control: Label
Properties:
OnSelect: =Select(Parent)
Text: =ThisItem.Kundennummer
FontWeight: =If(ThisItem.IsSelected, FontWeight.Semibold, FontWeight.Normal)
Height: =Self.Size * 1.8
PaddingBottom: =0
PaddingLeft: =12
PaddingRight: =0
PaddingTop: =0
VerticalAlign: =VerticalAlign.Top
Width: =Title1.Width
X: =Title1.X
Y: =Subtitle1.Y + Subtitle1.Height
- Subtitle1:
Control: Label
Properties:
OnSelect: =Select(Parent)
Text: =ThisItem.Kundenname
FontWeight: =If(ThisItem.IsSelected, FontWeight.Semibold, FontWeight.Normal)
Height: =Self.Size * 1.8
PaddingBottom: =0
PaddingLeft: =12
PaddingRight: =0
PaddingTop: =0
VerticalAlign: =VerticalAlign.Top
Width: =Title1.Width
X: =Title1.X
Y: =Title1.Y + Title1.Height
- Title1:
Control: Label
Properties:
OnSelect: =Select(Parent)
Text: =ThisItem.Titel
FontWeight: =If(ThisItem.IsSelected, FontWeight.Semibold, FontWeight.Normal)
Height: =Self.Size * 1.8
PaddingBottom: =0
PaddingLeft: =12
PaddingRight: =0
PaddingTop: =0
VerticalAlign: =VerticalAlign.Top
Width: =Parent.TemplateWidth - 86
X: =16
Y: =(Parent.TemplateHeight - (Self.Size*1.8 + Subtitle1.Size*1.8 + 2 + Body1.Size*1.8)) / 2
@mat5 - looks like the operators for your region are different. Could you try:
Sort(
'Genehmigungen Debitoren';
Modified;
If(
ctx_sort;
SortOrder.Ascending;
SortOrder.Descending
)
)
This is before
This is after:
@mat5 - could you apply the code I gave you (point 3) into the Items property of the Gallery and then take screenshot of what happens/any errors.
Hi Amik,
Thanks for the fast response!
I deleted the default and added the "UpdateContext" to the button. But the 3. is not working - maybe I'm on the wrong component? On the RecordsGallery1 in "Items" is 'Genehmigungen Debitoren' mentioned, when i delete this, no info is shown anymore in the list. I tried to change this 'Genehmigungen Debitoren' to your third point.
@mat5 -
1. Clear whatever you have in the Default property of the Gallery.
2. On the OnSelect property of your Button control, create a Local Context Variable:
UpdateContext({ctx_sort: !ctx_sort})
3. On the Items property of the Gallery control, use:
Sort(
'Genehmigungen Debitoren',
Modified,
If(
ctx_sort,
SortOrder.Ascending,
SortOrder.Descending
)
)
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional