How to sync two scrollviews in react native? - datatable

My requirement is to create a table with fixed header and first column, table data will scroll in both horizontal and vertical directions.
for this I have used 3 scrollviews , following gif will make it clear
1st scrollview is the header name row, it is set to horizontal = true (i.e its scroll direction is horizontal)
2nd scrollview is kcname 1st column of the table, it is vertical scroll, both of these have scrollEnabled={false}, as they wont take scroll gesture, they are scroll programmatically using scrollTo
3rd scrollview is body cell table filled with data, this view has 2 scrollviews as parent , one to take horizontal scroll and another to take vertical scroll.
the scroll values of two body scroll views are put in scrollTo of the other two scrollview using refs on onScroll event, scrollEventThrottle value is 16 .
My problem is how to sync these scrollviews scrolls as this clearly shows lag, which is not acceptable

Disable scrollTos animation like this:
this.toolbar.scrollTo({
x: yourXValue,
animated: false,
});
Then there is no lag :)

Related

trouble in scrolling in uitableview

I've created a Tableview populated with cells with a fixed tableView.rowHeight = 95.0
The problem is that when I add more cells and I try to scroll to the bottom, I can see only half cell at the bottom. I mean, when I try to scroll I can't scroll down so that to see the entire last cell added.
Seems the scrolling bar doesn't work well. Is this a bug of Xcode or did I make something wrong?
I don't want a resizable height cell but I want my cell fixed with with 95.0 but at the same time I want my scrollbar to work better.
The problem is if the table height exceeds the your mainview. At that time srollview of tableview also goes down.solution is keep the tableview height within the bounds of mainview(i.e your viewcontroller's view)

scroll problems with NSTableView in a custom view embedded in an NSScrollView

I have a right hand panel area in my app that's a tall vertical custom view (let's call this the column view) that contains 2 tableviews. Each tableview does not scroll, and although they are embedded in the standard clipview and scrollview, the vertical height of the tableview is the same as the total number of rows it contains, and bounce is disabled. As the number of rows increases, the background column view increases in height and needs to scroll vertically. It's also embedded in a scrollview. This sounds more complicated than it is, here's a pic:
Scrolling of the background column view works fine as long as the mouse pointer is not inside the red boxes, i.e., over the tableviews. I want to be able to vertically scroll regardless of where the mouse is located within the column view. Any ideas?
Update: here's a mainstream example of where tableviews embedded in a scrollview work correctly, in Tweetbot (assuming those sections are tableviews)
If you want to have scroll view inside other one (red area). You need to disable inner scroll view scrollWheel action. You can achieve that by writing custom NSScrollView subclass, and adding following method :
- (void)scrollWheel:(NSEvent *)theEvent {
// If scroll is disabled, send action to next responder
if (self.scrollEnabled == NO) {
[self.nextResponder scrollWheel:theEvent];
}
else {
[super scrollWheel:theEvent];
}
}
But don't think you need to have scroll view inside other scroll view. Rather you could use one table view with 2 kinds of cells, one for 'section header' and other for 'cell'.
This way you have one table view with multiple sections - just like in iOS.

slickgrid resize causes scrollbar gap near bottom

I have the following problem:
I use Slickgrid in combination with jquery layout. Panes can be resized with this plugin. When I resize the Slickgrid pane, so that a horizontal scrollbar appears, which wasn't there at first, I am unable to scroll all the way to the bottom.
I have created a jsfiddle to demonstrate:
http://jsfiddle.net/uNMRT/2/
Steps to reproduce:
make sure the slickgrid pane doesn't have a horizontal scrollbar.
scroll all the way doen. (works nicely, you can view record 119, the last one)
resize the slickgrid pane using the vertical splitter. Make sure to make the slickgrid area smaller to have a horizontal scrollbar appear.
scroll all the way down again. Notice that you are unable to scroll completely down. Record 119 can't be seen now.
I already do a resizeCanvas upon resize:
center__onresize: function(pane, $pane, state, options) {
myGrid.resizeCanvas();
}
That's not enough obviously. Any ideas?
I ran into the same issue and it seems like that slick grid does not set the "viewportHasHScroll" flag correctly. I found the following two workarounds to fix the issue (SlickGrid v2.1)
1) Update updateCanvasWidth function (line 396) and change the following line
viewportHasHScroll = (canvasWidth > viewportW - scrollbarDimensions.width);
to (notice the "greater than or equal to" sign
viewportHasHScroll = (canvasWidth >= viewportW - scrollbarDimensions.width);
2) Update handleScroll function (line 1920) and update the if block
//only scroll if they've moved at least one row
if(vScrollDist && (vScrollDist > options.rowHeight)) {
....
}
I am facing the same issue but for vertical scroll. If the container is resized the vertical scroll bar does not scroll completely. It stops on the second last record. Although there is space for the bar to scroll it cannot be moved completely to the bottom. If I pull it down the grid jumps and the bar moves to the original position again. The last record can never be viewed.
I had the issue also when I add a row. It is because you may have not updated the grid correctly. You have to call grid.updateRowCount();

Enable scrolling for NSTableView

I've added a NSTableView in a NSScrollView IB in Xcode 4. Its controller class is displaying data whose horizontal length exceeds its row width. However, no horizontal scroll bars appear, so do we have to enable them?
(the table only has one column with no headers)
The data width is not the determining factor if horizontal scrolling will be enabled. You need to ensure the NSTableColumn is wider that the NSTableView for horizontal scrolling to be enabled.

How to add a button or image to a vertical table header of scrollview?

I have seen a lot of programs had some buttons or images in the vertical or horizontal scrollview table header or bottom and click it to invloke some events, But I have searched interface builder library and not found some widget I can used , how these programs to implement it ? Thank you very much!
To add just above the vertical scroll bar, see -[NSTableView setCornerView:].
To add to the left of the horizontal scroll bar, you'll need to subclass NSScrollView and (in addition to creating/configuring/adding the auxiliary view of your choice) override -tile. You'd call [super tile], then adjust the horizontal scroller to make room, then position the auxiliary view to taste.

Resources