Project

General

Profile

Actions

Feature #13787

closed

WTableView: Add getters for size of viewport

Added by Michael Seibt about 1 year ago. Updated 24 days ago.

Status:
Closed
Priority:
High
Target version:
Start date:
06/19/2025
Due date:
% Done:

0%

Estimated time:

Description

We are porting a desktop application having wide tables. Single cell selection must work using arrow keys.
We have implemented this by handling signals keyWentDown and selectionChanged calling scrollTo.
In order to enable implementing page-wise movement on press of Key::PageUp / Key::PageDown, we need getters like

int countOfVisibleRows() const;
int countOfVisibleColumns() const;

(meaning entirely visible rows).
The necessary information "which cells are visible in the browser" is available in WTableView, but inaccessible because all private.
I.e. WTableView itself needs to be modified.

Actions #1

Updated by Michael Seibt 5 months ago

Implementation of the most important part WTableView::visibleRowCount(): https://github.com/emweb/wt/pull/239

Actions #2

Updated by Romain Mardulyn 5 months ago

  • Assignee set to Romain Mardulyn
Actions #3

Updated by Romain Mardulyn 5 months ago

  • Status changed from New to InProgress
Actions #4

Updated by Romain Mardulyn 5 months ago

  • Status changed from InProgress to New

Hi Michael,

If I understand correctly, what you want to do is to have a WTableView that does scroll the page when the selected cell is outside the browser window due to the WTableView not being completely visible in the browser window.

If that is the case, the viewportHeight_ and viewportWidth_ are probably not the values you are looking for as these are just the height and width of the contentContainer_.

Actions #5

Updated by Michael Seibt 5 months ago

Hi Romain,

I want that PgUp/PgDn select the cell visibleRowCount() rows below/above the currently selected cell.
The selected cells is made visible by means of scrollTo called from selectionChanged handler.
I do not want to control the scrollbars directly. They shall reflect the visible part of the TableView, and shall always be visible if there are more cells than fit into the widget's viewport.

For ajaxMode, it works for me with the implementation in https://github.com/emweb/wt/pull/239.
The implementation for plain mode was just a quick guess.

Actions #6

Updated by Michael Seibt 5 months ago

Anyway, I was surprised / disappointed that the selection (cell or row) cannot be moved by means of the usual movement keys out of the box. This might be a feature request.

Actions #7

Updated by Romain Mardulyn 5 months ago

  • Target version set to 4.14.0
Actions #8

Updated by Romain Mardulyn 2 months ago

  • Status changed from New to InProgress
Actions #9

Updated by Romain Mardulyn 2 months ago

  • Status changed from InProgress to Review
  • Assignee deleted (Romain Mardulyn)
Actions #10

Updated by emil de keyser about 2 months ago

  • Assignee set to emil de keyser
Actions #11

Updated by emil de keyser about 2 months ago

  • Status changed from Review to Resolved
  • Assignee changed from emil de keyser to Romain Mardulyn
Actions #12

Updated by Romain Mardulyn about 1 month ago

  • Status changed from Resolved to Implemented @Emweb
Actions #13

Updated by Romain Mardulyn 24 days ago

  • Status changed from Implemented @Emweb to Closed
Actions

Also available in: Atom PDF