Mercurial > demo / ui/pages/table_view.slint
changeset 17: |
e4c9ec452eb6 |
author: |
ellis <ellis@rwest.io> |
date: |
Sat, 27 May 2023 21:07:55 -0400 |
permissions: |
-rw-r--r-- |
description: |
ui work |
1 import { HorizontalBox, VerticalBox, StandardTableView, GroupBox} from "std-widgets.slint"; 2 import { UiConfig } from "../config.slint"; 3 import { Page } from "page.slint"; 5 export global TableViewPageAdapter { 6 callback sort_ascending(int); 7 callback sort_descending(int); 8 in property <[[StandardListViewItem]]> row_data: [ 9 [ { text: "Item 1.1" }, { text: "Item 1.2" }, { text: "Item 1.3" }, { text: "Item 1.4" }, ], 10 [ { text: "Item 2.1" }, { text: "Item 2.2" }, { text: "Item 2.3" }, { text: "Item 2.4" }, ], 11 [ { text: "Item 3.1" }, { text: "Item 3.2" }, { text: "Item 3.3" }, { text: "Item 3.4" }, ], 12 [ { text: "Item 4.1" }, { text: "Item 4.2" }, { text: "Item 4.3" }, { text: "Item 4.4" }, ], 13 [ { text: "Item 5.1" }, { text: "Item 5.2" }, { text: "Item 5.3" }, { text: "Item 5.4" }, ], 14 [ { text: "Item 6.1" }, { text: "Item 6.2" }, { text: "Item 6.3" }, { text: "Item 6.4" }, ], 18 export component TableViewPage inherits Page { 20 description: "StandardTableView can be used to display a list of text elements in columns and rows. It can be imported from \"std-widgets.slint\""; 26 title: "StandardTableView"; 30 sort-ascending(index) => { 31 TableViewPageAdapter.sort_ascending(index); 34 sort-descending(index) => { 35 TableViewPageAdapter.sort-descending(index); 39 { title: "Header 1" }, 40 { title: "Header 2" }, 41 { title: "Header 3" }, 42 { title: "Header 4" }, 44 rows: TableViewPageAdapter.row_data;