mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
* WIP: Add ITableDataSource * WIP: Refactor TableView * WIP: Port CSVEditor * WIP: Port TableEditor * WIP: Port MultiColouredTable scenario * Fix bug of adding duplicate column styles * Update tests to use DataTableSource * Tidy up * Add EnumerableTableDataSource<T> * Add test for EnumerableTableDataSource * Add test for EnumerableTableDataSource * Add code example to xmldoc * Add ProcessTable scenario * Rename ITableDataSource to ITableSource and update docs * Rename EnumerableTableDataSource to EnumerableTableSource * Fixed Frame != Bounds; changed UICat Scenarios list to use tableview! * Fix scroll resetting in ProcessTable scenario * Fix unit tests by setting Frame to same as Bounds * Document why we have to measure our data for use with TableView --------- Co-authored-by: Tig Kindel <tig@users.noreply.github.com>
This commit is contained in:
@@ -52,13 +52,30 @@ tableView = new TableView () {
|
||||
Height = 10,
|
||||
};
|
||||
|
||||
tableView.Table = yourDataTable;
|
||||
tableView.Table = new DataTableSource(yourDataTable);
|
||||
```
|
||||
|
||||
## Object data
|
||||
If your data objects are not stored in a `System.Data.DataTable` then you can instead
|
||||
create a table using `EnumerableTableSource<T>` or implementing your own `ITableSource`
|
||||
class.
|
||||
|
||||
For example to render data for the currently running processes:
|
||||
|
||||
```csharp
|
||||
tableView.Table = new EnumerableTableDataSource<Process> (Process.GetProcesses (),
|
||||
new Dictionary<string, Func<Process, object>>() {
|
||||
{ "ID",(p)=>p.Id},
|
||||
{ "Name",(p)=>p.ProcessName},
|
||||
{ "Threads",(p)=>p.Threads.Count},
|
||||
{ "Virtual Memory",(p)=>p.VirtualMemorySize64},
|
||||
{ "Working Memory",(p)=>p.WorkingSet64},
|
||||
});
|
||||
```
|
||||
|
||||
## Table Rendering
|
||||
TableView supports any size of table (limited only by the RAM requirements of `System.DataTable`). You can have
|
||||
thousands of columns and/or millions of rows if you want. Horizontal and vertical scrolling can be done using
|
||||
the mouse or keyboard.
|
||||
TableView supports any size of table. You can have thousands of columns and/or millions of rows if you want.
|
||||
Horizontal and vertical scrolling can be done using the mouse or keyboard.
|
||||
|
||||
TableView uses `ColumnOffset` and `RowOffset` to determine the first visible cell of the `System.DataTable`.
|
||||
Rendering then continues until the avaialble console space is exhausted. Updating the `ColumnOffset` and
|
||||
|
||||
Reference in New Issue
Block a user