on 2018 Nov 12 12:32 PM
Has anyone ever tried to synchronize two tables in SAPUI5. Not the data/models of the tables but the controls themselves. So e.g. when I scroll in one table, it automatically scrolls the other one, too, or when I adjust the column width of the one table, the other table's columns get adjusted.
I'm curious for any input!
Not sure if you have already figured it out but here's how you can synchronize the horizontal scrolling for two tables.
In onAfterRendering method write this jQuery code
$(".sapUiTableHSb").on('scroll', function () {
$(".sapUiTableHSb").scrollLeft($(this).scrollLeft());
});
sapUiTableHSb is a class of horizontal scrollbar of a table. This should synchronize the horizontal scrollbars of all the tables in your view.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
with jquery you may use something like this $(document).scrollTop() or $(document).scrollLeft()... just replace the doc... w the scroll bar element and you should be good... a nice google search on scroll position will give you additional details
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes... this was a challenging one for me... you will need to scroll using jquery.... basically get the scroll position for x/y from the scrolling table... and then set the same values on the other table... I did this for horizontal and vertical scrolling.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks 9958e4b6df99431a84a41b015b639ac8 for your reply! Can you provide me with an example of how you did it? I'm not an experienced jQuery developer, so I've no clue where to start..
That's how I set my two tables:
<table:Table id="uploadData">
<table:columns>
<!-- Columns created in controller -->
</table:columns>
<table:rows>
<!-- Rows created in controller -->
</table:rows>
</table:Table>
</m:Panel>
<m:Panel id="generatedTableView">
</m:Panel>
for "uploadData", I bind the Columns and Rows seperately in my controller.
As for the second table, it get's called by
this.callbackAPI.generatedTableView.byId("dataTable") **and then** placeAt("generatedTableView")
So I can't exactly access the properties of the second table, right?
I'd be thankful for any deeper instructions!
User | Count |
---|---|
59 | |
11 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.