Project

General

Profile

WTableView with vertical scroll

Added by Mykola Stupnytskyi almost 5 years ago

Hey there,

I finally lost all my ideas how to get WTableView to behave as Excel spreadsheet.

Is the any way to adapt height of WTableView with the height of his parent component?

Looks like component is implemented to use with fixed height.

What about the resize of the browser page, how to handle that properly?

Here is what I have how.

public class ProspectsWidget extends WContainerWidget {
    private WFitLayout layout;
    private WTableView tableView;

    class WTableView2 extends WTableView {
        public WTableView2() {
            super();
            super.setLayoutSizeAware(true);
        }
    }

    public ProspectsWidget() {
        super();
        setLayoutSizeAware(true);

        this.layout = new WFitLayout();
        this.tableView = new WTableView2();

        buildContent();
    }

    private void buildContent() {
        setLayout(layout);

        tableView.setModel(new ProspectsTableModel(tableView));
        tableView.setRowHeaderCount(1);
        tableView.setSortingEnabled(true);
        tableView.setRowHeight(new WLength(28));
        tableView.setHeaderHeight(new WLength(35));
        tableView.setInline(false);
        tableView.setAlternatingRowColors(true);
        tableView.setSelectionMode(SelectionMode.ExtendedSelection);
        tableView.setOverflow(WContainerWidget.Overflow.OverflowAuto, Orientation.Vertical);

        layout.addWidget(tableView);
    }
}

How to have vertical scroll inside of WTableView but not on the page?


Replies (1)

RE: WTableView with vertical scroll - Added by Mykola Stupnytskyi almost 5 years ago

Resolved!

Sorry for inconvenient.

Problem was in the way how I used layouts.

    (1-1/1)