I'm trying to create a delete button that fits nicely into a Vaadin form (and maybe in the future even more custom fields). I can't seem to get the alignment correctly. How should this be done properly?
See click me button in:
https://vaadin-example-cknsvo.stackblitz.io
https://stackblitz.com/edit/vaadin-example-cknsvo?file=views/engatta-app.ts
If you wrap those elements with a flexbox, such as a vaadin-horizontal-layout or just a div with display:flex they will align vertically.
Related
Currently using Vaadin 23 and was wondering if it was possible to use scroll horizontally within a Grid programmatically, much like some of the built-in functionality with scrolling to the top or bottom row. However, in this case I would like to scroll using a column as reference (while maintaining the current vertical scroll position).
One idea would be to put a component into the column header, and then scroll to that component. Something like:
Grid.Column<SamplePerson> emailColumn = grid.addColumn("email");
Span emailHeaderText = new Span("Email");
emailColumn.setHeader(emailHeaderText);
Button scrollToEmail = new Button("Scroll", e ->
emailHeaderText.scrollIntoView()
);
It doesn't work perfectly, as the header component does not cover the whole column width, but it might be good enough.
I'm building a page to enter a blog using Vaadin Flow 23.
Using TextArea I need to either expand the TextArea to fill the available space or make it so the user can resize the text area by clicking the bottom right-hand corner and dragging (or similar).
The problem is that I'm using the TextArea inside a FormLayout.
The FormLayout doesn't support 'expand()' or similar and the TextArea lacks the bottom corner drag point we see in many text editors.
I can't remove the FormLayout but am otherwise open to suggestions.
Is there a way in Vaadin 7 or Vaadin 8 to move the save/cancel buttons to under the last editor column? Or maybe to left justify them? Right now they are right justified under the last column. I would even take left justifying them under this same column. Visually, it is far from the last thing the users edited, so some users get confused. The way I am clarifying it for users right now is by making the Grid as narrow as possible, but it wastes screen real estate.
This will be very difficult in generic case, where column widths can be freely adjusted or their widths are automatically calculated by content. However if you set your columns fixed widths, so that you can make assumptions based on that within your specific application, there is a solution.
Just noting, that the Editor has div, with class name "v-grid-editor-footer", which has the same width as the Grid. So the editor footer does not have logical cells, that would be aligned with Grid's cells. And that is the challenge here. Furthermore the buttons you are refering to are wrapped in a child div of the previous one, with class name "v-grid-editor-buttons"
However you can try to add css rules in your theme in the following way.
.v-grid-editor-buttons {
position: relative;
left: -300px; // Adjust this value experimentally so that it fits your need
}
Below is a screenshot the css applied to Vaadin's Sampler.
I created my form and it looks fine in the standard size when ran with the program, however when I maximize the form, the components get messed up. I anchored the components on the left and right, however a giant gap is created in the middle of the form and I don't know how to fix it. When in the 'Design' view of the program, all my components are touching from me trying to fill the middle gap. I tried aligning, anchoring and searched online for a while with no luck. Any clue?
Form in standard size upon running program:
Form in full screen with giant middle gap:
From the form's OnResize event, you can compute the width and left property values for the component to fit the new size. You can adjust the width of components or distribute the distance between components to get the look you want. Or a combination of the two.
It is also possible to put the components on two lines if the form's width becomes too small. Or use a scroll panel so that the user can scroll to see what is not possible to show correctly given the width.
All that requires coding. Parts can be done using panels and align the panels.
Searched all over Google and I'm afraid I can't find an answer to this.
Here is my current situation:
Instead of having those checkbox aligned to the left I want them centered like so (photoshopped obviously):
Anybody know how to achieve this with VCL? Thanks.
Edit:
These components are inside a TGridPanel and for whatever reason the Left and Top properties have no effect on the position of the component in the cell. I have also looked for any layout properties with no luck.
The controls inside the TGridPanel are automatically center-aligned. If you reduce the width of the checkboxes to the correct value it should be centered as requested. Be aware that if you reduce the size too much the checkbox will shrink.
I managed to find a solution although it's rather messy. But for future reference I had to create a panel for every single cell in my GridPanel then that allowed me to set the left padding property of the panel to push my TCheckboxes over.
Yes it's super inefficient but it's the best I've got so far. Also fixes my issue of wanting to show the cell outlines inside the GridPanel.