-
-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scroll To Selected Item #150
Comments
Hi @dsbw ! Sorry for late reply. Is new item always last? You can try adapting e.g. this solution, something like: {:fx/type fx/ext-on-instance-lifecycle
:on-created (fn [^TableView view] (-> view .getItems ...))
:desc {:fx/type :table-view ...}} |
Thanks, vlaaad! This code "works" in the sense that it is called and seems to be called on the right object with the right parameters:
But I'm not seeing any actual change in the tableview. I'm trying to create a minimal example. Update: OK, no big challenge, this shows exactly what I'm seeing, minus the fact in actual practice I have a row selected, but I think that shouldn't affect
You'll see it says "SCROLLING TO 25" but it won't actually scroll there. Or it is scrolling there and something else is forcing it to the top? And it doesn't matter what value you put in for |
What your code does is scrolling to view as soon as table is created. It was not yet laid out in a scene graph, so it probably has some default bounds and scrolling probably wouldn't work. You probably want to wrap your Also, this is not exactly what you want, right? You want scrolling on adding items to the table, so you also need to add items listener, i.e. a Clojure equivalent of |
The
In this particular case, I have a tabbed pane where, when one tab shows the list of items and the other tab allows entry of the items, and on saving of the item it switches back to the list, so I'm not watching LIVE per se. Not sure how much that matters. I swapped out the on-created to use a listener:
And then at the bottom, I added to items:
When I run it, I see:
Which is what I'd expect, though it still does not scroll. |
Hi, vlaaad!
Example 27 shows how to change the currently selected item on tables, trees, listbox—which works great—but if you shrink the window down, you'll notice that while the item will be selected, the control will not scroll to it.
How would we get that effect?
(In my situation, I've got a data entry form that adds an item to a table, and when the item in the data entry form is saved, it's put into the table and selected...but I'd like it also always be visible.)
The text was updated successfully, but these errors were encountered: