with_rows

Function with_rows 

Source
pub fn with_rows(rows: Vec<Row>) -> TableOption
Expand description

Creates an option to set table rows during construction.

This option populates the table with initial data rows. Each row should have the same number of cells as there are columns.

§Arguments

  • rows - Vector of row data

§Examples

use bubbletea_widgets::table::{Model, with_rows, Row};

let table = Model::with_options(vec![
    with_rows(vec![
        Row::new(vec!["001".into(), "Alice".into()]),
        Row::new(vec!["002".into(), "Bob".into()]),
    ]),
]);
assert_eq!(table.rows.len(), 2);