Skip to content

Commit b93284b

Browse files
committed
update examples with async reinstantiateModalForms
1 parent bc6cf8b commit b93284b

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

examples/templates/index.html

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ <h4>
119119
dataUrl: "books/",
120120
dataElementId: "#books-table",
121121
dataKey: "table",
122-
addModalFormFunction: updateBookModalForm
122+
addModalFormFunction: reinstantiateModalForms
123123
}
124124
});
125125
}
@@ -153,22 +153,35 @@ <h4>
153153
dataUrl: "books/",
154154
dataElementId: "#books-table",
155155
dataKey: "table",
156-
addModalFormFunction: updateBookModalForm
156+
addModalFormFunction: reinstantiateModalForms
157157
}
158158
});
159159
});
160160
}
161161
updateBookModalForm();
162162

163163
// Delete book buttons - formURL is retrieved from the data of the element
164-
$(".delete-book").each(function () {
165-
$(this).modalForm({formURL: $(this).data("form-url"), isDeleteForm: true});
166-
});
164+
function deleteBookModalForm() {
165+
$(".delete-book").each(function () {
166+
$(this).modalForm({formURL: $(this).data("form-url"), isDeleteForm: true});
167+
});
168+
}
169+
deleteBookModalForm();
167170

168171
// Read book buttons
169-
$(".read-book").each(function () {
170-
$(this).modalForm({formURL: $(this).data("form-url")});
171-
});
172+
function readBookModalForm() {
173+
$(".read-book").each(function () {
174+
$(this).modalForm({formURL: $(this).data("form-url")});
175+
});
176+
}
177+
readBookModalForm();
178+
179+
function reinstantiateModalForms() {
180+
createBookAsyncModalForm();
181+
readBookModalForm();
182+
updateBookModalForm();
183+
deleteBookModalForm();
184+
}
172185

173186
// Filter books button
174187
$("#filter-book").each(function () {

0 commit comments

Comments
 (0)