Project

General

Profile

Actions

Feature #13787

closed
MS RM

WTableView: Add getters for size of viewport

Feature #13787: WTableView: Add getters for size of viewport

Added by Michael Seibt about 1 year ago. Updated about 2 months 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.

MS Updated by Michael Seibt 6 months ago Actions #1

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

RM Updated by Romain Mardulyn 6 months ago Actions #2

  • Assignee set to Romain Mardulyn

RM Updated by Romain Mardulyn 6 months ago Actions #3

  • Status changed from New to InProgress

RM Updated by Romain Mardulyn 6 months ago Actions #4

  • 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_.

MS Updated by Michael Seibt 6 months ago Actions #5

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.

MS Updated by Michael Seibt 6 months ago Actions #6

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.

RM Updated by Romain Mardulyn 6 months ago Actions #7

  • Target version set to 4.14.0

RM Updated by Romain Mardulyn 3 months ago Actions #8

  • Status changed from New to InProgress

RM Updated by Romain Mardulyn 3 months ago Actions #9

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

ED Updated by emil de keyser 3 months ago Actions #10

  • Assignee set to emil de keyser

ED Updated by emil de keyser 3 months ago Actions #11

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

RM Updated by Romain Mardulyn 2 months ago Actions #12

  • Status changed from Resolved to Implemented @Emweb

RM Updated by Romain Mardulyn about 2 months ago Actions #13

  • Status changed from Implemented @Emweb to Closed
Actions

Also available in: PDF Atom