@@ -26,7 +26,7 @@ pub fn Cell(col: usize, row: usize, state: &Hook<State>) -> impl View + '_ {
2626 value = & "" ;
2727 }
2828
29- let onremove_row = state. bind ( move |state, event : MouseEvent < HtmlElement > | {
29+ let ondestroy_row = state. bind ( move |state, event : MouseEvent < HtmlElement > | {
3030 let row = match event. target ( ) . get_attribute ( "data" ) {
3131 Some ( r) => r,
3232 None => return ,
@@ -36,7 +36,7 @@ pub fn Cell(col: usize, row: usize, state: &Hook<State>) -> impl View + '_ {
3636 Err ( e) => return ,
3737 } ;
3838
39- state. remove_row_main ( row_usize) ;
39+ state. destroy_row_main ( row_usize) ;
4040 } ) ;
4141
4242 let onadd_row = state. bind ( move |state, event : MouseEvent < HtmlElement > | {
@@ -91,7 +91,7 @@ pub fn Cell(col: usize, row: usize, state: &Hook<State>) -> impl View + '_ {
9191 <td. destroy-container>
9292 <button. destroy
9393 data={ row}
94- onclick={ onremove_row }
94+ onclick={ ondestroy_row }
9595 />
9696 </td>
9797 } )
@@ -126,7 +126,7 @@ pub fn Cell(col: usize, row: usize, state: &Hook<State>) -> impl View + '_ {
126126 <td. destroy-container>
127127 <button. destroy
128128 data={ row}
129- onclick={ onremove_row }
129+ onclick={ ondestroy_row }
130130 />
131131 </td>
132132 } )
@@ -148,7 +148,7 @@ pub fn Cell(col: usize, row: usize, state: &Hook<State>) -> impl View + '_ {
148148 <td. destroy-container>
149149 <button. destroy
150150 data={ row}
151- onclick={ onremove_row }
151+ onclick={ ondestroy_row }
152152 />
153153 </td>
154154 } )
@@ -163,3 +163,29 @@ pub fn Cell(col: usize, row: usize, state: &Hook<State>) -> impl View + '_ {
163163 }
164164 }
165165}
166+
167+ // #[component(auto_branch)]
168+ // pub fn AddRow(
169+ // row: usize,
170+ // onadd_row_fn: &dyn Fn(&mut State, MouseEvent<HtmlElement>)
171+ // ) -> impl View {
172+ // view! {
173+ // <button.add
174+ // data={row}
175+ // onclick={onadd_row_fn}
176+ // />
177+ // }
178+ // }
179+
180+ // #[component(auto_branch)]
181+ // pub fn DestroyRow(
182+ // row: usize,
183+ // ondestroy_row_fn: &dyn Fn(&mut State, MouseEvent<HtmlElement>)
184+ // ) -> impl View {
185+ // view! {
186+ // <button.destroy
187+ // data={row}
188+ // onclick={ondestroy_row_fn}
189+ // />
190+ // }
191+ // }
0 commit comments