Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Verified Answer
+1
person also asked this
people also asked this
Replies
3 replies
Subscribers
8 subscribers
Views
3075 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
User Interface
Align image center
sergiog
over 7 years ago
We need to align an image to the center of the sail form, we tried adding the image to a section with one column but the image appears at the left of the screen.
Thank you for your time.
Add an example image
Bye ;-)
OriginalPostID-254017
Discussion posts and replies are publicly visible
Parents
+1
chetany
A Score Level 1
over 7 years ago
As mentioned by Tajinder, there is no direct way. However, we can exploit the editable grid or the paging grid to align the image to center. The idea is to give the columns weight with the center one having higher weight than the other two columns. and use alignments.
Here's a sample code, (Note: replace the number 3886 with docId of an image):
a!gridLayout(
labelPosition: "ABOVE",
headerCells: {
a!gridLayoutHeaderCell(align: "RIGHT"), a!gridLayoutHeaderCell(align: "CENTER"),a!gridLayoutHeaderCell(align: "LEFT")
},
columnConfigs: {
a!gridLayoutColumnConfig( weight: "3"),
a!gridLayoutColumnConfig(weight: "4"),
a!gridLayoutColumnConfig(weight: "3")
},
rows: {
a!gridRowLayout(
contents: {
a!textField(readOnly: true,disable: true),
a!imageField(
images: { a!documentImage(document: 3886)}
),
a!textField(readOnly: true,disable: true)
}
)
},
selectionSaveInto: {},
validations: {}
)
This does align the image to the center of the page. And if you are using Sites, it will be exactly at the center. It also works on mobile display. I tried different resolutions in chrome browser, and the image always remained in the center. I am attaching a screenshot of what the result looks like.
Note: instead of editable grid, you could also use paging grid and employ a similar trick. But, paging grid gives a slightly grey background to the columns. Hence editable grid would be better.(end-user wont be able to make out that its a grid since we are not showing any text) This is of-course a hack, but could be used.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Reject Answer
Cancel
Reply
+1
chetany
A Score Level 1
over 7 years ago
As mentioned by Tajinder, there is no direct way. However, we can exploit the editable grid or the paging grid to align the image to center. The idea is to give the columns weight with the center one having higher weight than the other two columns. and use alignments.
Here's a sample code, (Note: replace the number 3886 with docId of an image):
a!gridLayout(
labelPosition: "ABOVE",
headerCells: {
a!gridLayoutHeaderCell(align: "RIGHT"), a!gridLayoutHeaderCell(align: "CENTER"),a!gridLayoutHeaderCell(align: "LEFT")
},
columnConfigs: {
a!gridLayoutColumnConfig( weight: "3"),
a!gridLayoutColumnConfig(weight: "4"),
a!gridLayoutColumnConfig(weight: "3")
},
rows: {
a!gridRowLayout(
contents: {
a!textField(readOnly: true,disable: true),
a!imageField(
images: { a!documentImage(document: 3886)}
),
a!textField(readOnly: true,disable: true)
}
)
},
selectionSaveInto: {},
validations: {}
)
This does align the image to the center of the page. And if you are using Sites, it will be exactly at the center. It also works on mobile display. I tried different resolutions in chrome browser, and the image always remained in the center. I am attaching a screenshot of what the result looks like.
Note: instead of editable grid, you could also use paging grid and employ a similar trick. But, paging grid gives a slightly grey background to the columns. Hence editable grid would be better.(end-user wont be able to make out that its a grid since we are not showing any text) This is of-course a hack, but could be used.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Reject Answer
Cancel
Children
No Data