Skip to content

Commit 767cc48

Browse files
committed
fixed getter example
1 parent 3aeae8f commit 767cc48

4 files changed

Lines changed: 8 additions & 12 deletions

File tree

examples/getter/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ chrono = { version = "0.4", features = ["serde"] }
1010
console_error_panic_hook = "0.1"
1111
console_log = "1"
1212
log = "0.4"
13-
serde = "1"
1413
async-trait = "0.1"
1514

1615
[dev-dependencies]

examples/getter/src/main.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
use async_trait::async_trait;
21
use chrono::NaiveDate;
32
use leptos::*;
43
use leptos_struct_table::*;
5-
use serde::{Deserialize, Serialize};
64

75
// This generates the component BookTable
8-
#[derive(TableComponent, Serialize, Deserialize, Debug, Clone, Default, PartialEq)]
9-
#[table(sortable)]
6+
#[derive(TableRow, Clone)]
7+
#[table(sortable, impl_vec_data_provider)]
108
pub struct Book {
11-
#[table(key)]
129
pub id: u32,
1310
pub title: String,
1411

@@ -36,7 +33,7 @@ impl Book {
3633
}
3734
}
3835

39-
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq)]
36+
#[derive(Clone)]
4037
pub struct Author {
4138
pub first_name: String,
4239
pub last_name: String,
@@ -47,7 +44,7 @@ fn main() {
4744
console_error_panic_hook::set_once();
4845

4946
mount_to_body(|| {
50-
let items = create_rw_signal(vec![
47+
let rows = vec![
5148
Book {
5249
id: 1,
5350
title: "The Great Gatsby".to_string(),
@@ -88,10 +85,12 @@ fn main() {
8885
publish_date: NaiveDate::from_ymd_opt(1922, 2, 2).unwrap(),
8986
author_name: Default::default(),
9087
},
91-
]);
88+
];
9289

9390
view! {
94-
<BookTable items=items />
91+
<table>
92+
<TableContent rows />
93+
</table>
9594
}
9695
})
9796
}

examples/selectable/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ chrono = { version = "0.4", features=["serde"] }
1010
console_error_panic_hook = "0.1"
1111
console_log = "1"
1212
log = "0.4"
13-
serde = "1"
1413
async-trait = "0.1"
1514

1615
[dev-dependencies]

examples/simple/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ chrono = { version = "0.4", features = ["serde"] }
1010
console_error_panic_hook = "0.1"
1111
console_log = "1"
1212
log = "0.4"
13-
serde = "1"
1413
async-trait = "0.1"
1514

1615
[dev-dependencies]

0 commit comments

Comments
 (0)