Skip to content

Commit f9622da

Browse files
committed
use bauUpdate
1 parent 7e5665b commit f9622da

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

frameworks/non-keyed/bau/main.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,25 @@ bau.derive(() => {
123123
if (val) val.className = "danger";
124124
});
125125

126-
const Row = ({ id, label }) =>
127-
tr(
128-
td({ class: "col-md-1" }, id),
129-
td({ class: "col-md-4" }, a({ onclick: selectRow }, label)),
130-
td(
131-
{ class: "col-md-1" },
132-
a({ onclick: remove(id) }, span({ class: "glyphicon glyphicon-remove", "aria-hidden": true }))
133-
),
126+
const Row = ({ id, label }) => {
127+
const tdIdEl = td({ class: "col-md-1" }, id);
128+
const aLabelEl = a({ onclick: selectRow }, label);
129+
const aRemove = a({ onclick: remove(id) }, span({ class: "glyphicon glyphicon-remove", "aria-hidden": true }));
130+
131+
return tr(
132+
{
133+
bauUpdate: (element, data) => {
134+
tdIdEl.textContent = data.id;
135+
aLabelEl.replaceWith(a({ onclick: selectRow }, data.label));
136+
aRemove.onclick = remove(data.id);
137+
},
138+
},
139+
tdIdEl,
140+
td({ class: "col-md-4" }, aLabelEl),
141+
td({ class: "col-md-1" }, aRemove),
134142
td({ class: "col-md-6" })
135143
);
144+
};
136145

137146
const Button = ({ id, title, onclick }) =>
138147
div(

frameworks/non-keyed/bau/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"vite": "^4.4.8"
2222
},
2323
"dependencies": {
24-
"@grucloud/bau": "0.90.0",
24+
"@grucloud/bau": "0.91.0",
2525
"bootstrap": "3.3.6"
2626
}
2727
}

0 commit comments

Comments
 (0)