posted 8 years ago
I have a tableview page in my project where I need to control the scroll position dynamically. I tried to a lot and got the control of the table view to scroll, but the data is not changing when I change the scroll position.
==============================================================================
TableView tableView...
ScrollBar bar = getVerticalScrollbar(m_tableView);
bar.setValue(m_scrollpos);
bar.valueProperty().addListener(
new ChangeListener<Number>()
{
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
double value = newValue.doubleValue();
if(m_scrollpos > 0.0 && !isChanged){
isChanged = true;
}
else{
m_scrollpos = value;
}
ScrollBar bar = getVerticalScrollbar(m_tableView);
bar.setValue(m_scrollpos);
VirtualFlow vf = ((VirtualFlow)((TableViewSkin)m_tableVie w.getChildrenUnmodifiable().get(0)).getC hildrenUnmodifiable().get(1));
// System.out.println(vf.getFirstVisibleCel l().getIndex()+", "+vf.getLastVisibleCell().getIndex() );
m_index = vf.getLastVisibleCell().getIndex();
// m_tableView.scrollTo(m_index);
System.out.println(m_index);
}
});
======================================== ===================================
So the question is - How do I correctly handle the scroll position dynamically for my table, so that the data will change accordingly ?.