Is there a way to auto-scroll horizontally in a Vaadin Grid? - vaadin

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.

Related

HorizontalSplitPanel - Adjust the splitter position based on component width

Is there a way to add more than 2 components in HorizontalSplit panel without nesting it?
Splitter position should be based on the space allocated for the component. There is nesting of horizontal split panel but the splitter position is not set based on the component visible space
If you want a separate resizable split area for each of those components, then no, you cannot do that with just one split panel and nesting is indeed the solution. If you are fine with just one split, then you can add a layout instead of a component and just keep inserting more components to the layout.
You can use splitPanel.setSplitPosition for adjusting the split position. If your desired split position isn't static and your contents don't have fixed sizes, you could possibly use a tool like SizeReporter add-on for querying the content sizes. Note that this will undeniably cause some flickering, because you need to add the component to the layout before you can measure its size.
A horizontal splitpanel allows one component on the left and one on the right side.
Nothing more
What do you want to achieve?
If you add two layouts to HorizontalSplit there is nothing stopping you in adding more than one component to those layouts. You can also add new SplitLayouts to existing splitlayouts if you want that.

Custom ListboxItem Style in Firemonkey application - Delphi 10.1 Berlin

I am trying to create a a custom ListBoxItem style for my firemonkey listbox.
I need to have 2 labels, 2 progress bars, and three buttons on each item.
The three buttons should all be aligned right. The remaining controls should be position in 2 rows. i.e. I need 1 label (aligned left) and 1 progress bar (aligned right) on top and another label and progress bar on bottom.
e.g.
I can get it to look like the follow.
i.e. 1 row of controls
but not 2 rows. I tried using a TGridLayout, and a TGridPanelLayout and placing the controls in them, but using those controls do not work in the style. I get crazy results.
Here is my Style sheet for one row of controls
How can I get it to do two rows?
Another thing I tried was to add a Layout to hold both rows of controls, then a separate layout for each row.
Howeever, if I align on layout top and another layout bottom, then i have a gap when resizing
e.g.
ahh, looks like I can do this with Anchors on the top row layout and bottom row layout to get the look I need (remove the gaps). I will keep it open and if someone gives a better answer on this, I will accept their answer

Angular UI Grid change orientation to horizontal?

I am not sure if I need to change the grid templates or if there is a regular way:
I want a horizontal grid with 20 items.
The grid dont need horizontal scrollig because the pagination is below.
Each item should have the same fix size.
Each item should have a top down order (and not left to right).
Its my first time with ui grid and I tried a bit but the result is "crap" :/ An working example will be so nice :)

ios 8 layout using uitableview static cell & uitableview dynamic prototypes

I work on a app, nothing fancy, but since is my first app, there alot of stuff I never did before.
So, I'm trying to build a view like the image attached.
I've looked up on the Internet how to do something like that but I don't know what is better/cleaner way to do.
As you can see I have 3 areas: the title, the tableview in the middle and a button on the lower side.
The table will expand based on the content (3 lines or 30 lines) so the button must move down and a scroll bar should appear.
So, my idea:
Using a tableview having 3 static cells: one to put my title, second to put a tableview having prototypes cells, and a third one for the button.
That way I would have a scroll bar when the table in the middle grows, pushing the button.
Here I have a question: how to have the table view (the inner tableview) resize itself, pushing the height of the middle row, instead of having a fixed width with a scroll.
Is the the best way to achieve that?
Thanks for any idea.
C.C.
Are you sure you want to push the bottom UI down as the table grows? You say whether the table has 3 or 30 cells, but what if it has 300 cells? Your user then has to scroll to the bottom to reach the button and tab bar. I think you'll find that it would be better to use Auto Layout and let the table fill the screen space between the title and the button. The table will scroll so if you have 300 cells then you can scroll through inside the table's available area.
The advantage here is you won't be fighting with Auto Layout. If your user rotates an iPhone 4S into landscape you'll only have a few rows displayed but conversely if they run in portrait on an iPad you'll fill all of that space.
As for how to do it, the other advantage is that you don't need the nested table you describe. Use a constraint to attach the title label to the top layout guide, then attach the tab bar to the bottom layout guide. Put a vertical space constraint between the button and the tab bar. Finally, put vertical space constraints between the table and the title & the table and the button. (You'll need to implement constraints for the horizontal axis as well, but that's pretty simple.)
There's are refinements you can put into place if you want the table to shrink to fit if there are only 3 rows, but this should get you started and you may not want that anyway.
Key point: the tableView wants to scroll naturally, inside a view sized to fit the display. Don't change that behavior unless you really have to. Neither your users nor UIKit expects what you're trying to do, and the table is going to fight you all the way about it.
Nesting UIScrollViews (which your nested table would do) works, but it opens up a lot of bad UI flow problems. In my experience every time somebody wants nested scrollViews there's some other approach which is more "natural" to iOS interface paradigms.
If you're dead set on the UI you described I wouldn't use a table for the outer structure. Just make it a UIScrollView and calculate your content size based on the number of rows the table will display. You can actually do that, and then use Auto Layout as I described.

Scroll bars on DB grids - seeking a definitive approach

I see lots of DB scroll bar questions, but never seem to find a definitive answer to this one.
There is no option (property) to add/hide DB grid scroll bars, either singly or jointly. The simply auto-appear when needed.
If I don't have enough rows to scroll, I would like my columns to fill the entire grid.
If I design it so then when a vertical scroll bar is added at run-time a horizontal scrollbar is auto-added too (since I just covered the right part of the right most column with a vertical scroll bar, we now need a horizontal scroll bar to see what I am covering).
One option is to design my grid such that there is enough space at the right hand size (how many pixels?) to accommodate a vertical scroll, but that is unsightly until there are enough rows to trigger a scroll bar (if ever).
It seems to me that the most aesthetically pleasing way would be start with a grid which is filled with columns at X pixels wide and increase its width to X + width of vertical scroll bar (or decrease the width of one/some of the grids columns by a total of width of vertical scroll bar) pixels when adding a new row causes the vertical scrollbar to appear.
Am I missing something? Is there a “correct” way to do this, or an industry standard way (I am not asking for a “best” way or anything too subjective, so please don’t close. I believe that a lot of people need to know this).
Is there anything in the standard TDBgrid to facilitate this?
Bonus: I subscribe to TMS components, so if there is a way to do this simply with TAdvDbgrid, that would be fine for me, but a general solution with TDBgrid would be fine.
Non-subjective question: Given that
- I do not want to increase the width of my TDBgrid
- and that I do not want a blank white column at the right when no vertical scroll bar is present
- and that I am willing to decrease the width of my right-most column in order to avoid a horizontal scroll bar appearing when a vertical scroll bar appears
... how do I do so?
[Update]
Ken was rightly awarded the answer becuse his solution is best for most users.
For those like me who already paid for a TMS subscription, I just noticed that their TDbAdvgrid component has a ScrollBars property and when I set it to ssVertical, it does what I want.
Now, if I could only figure out a good way to have fixed header row when it is the only row ...
TJvDBGrid (part of the JEDI JVCL) has this capability built in, and includes source code. It should be able to either do what you need, or give you the details needed to implement your own descendant.

Resources