From af9e144955ad8af32d931432909fd31ab87be3b6 Mon Sep 17 00:00:00 2001 From: Hieu Vu Van <42837030+vuvanhieu143@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:47:43 +0700 Subject: [PATCH] Update Inplace editable docs with new events and template --- docs/apis/subsystems/output/inplace.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/apis/subsystems/output/inplace.md b/docs/apis/subsystems/output/inplace.md index 11a4f4c131..835d05f8e2 100644 --- a/docs/apis/subsystems/output/inplace.md +++ b/docs/apis/subsystems/output/inplace.md @@ -266,7 +266,7 @@ class inplace_edit_select extends \core\output\inplace_editable { $renderer = $PAGE->get_renderer('core'); $inplaceedit = new tool_mytest\local\inplace_edit_text($record); $params = $inplaceedit->export_for_template($renderer); -echo $OUTPUT->render_from_template('core/inplace_edit', $params); +echo $OUTPUT->render_from_template('core/inplace_editable', $params); ``` @@ -284,7 +284,7 @@ $params = $inplaceedit->export_for_template($renderer); ``` ```js title="The params are transferred via webservice and are then processed by JavaScript" -Templates.renderForPromise('core/inplace_edit', params) +Templates.renderForPromise('core/inplace_editable', params) .then(({html, js}) => { Templates.replaceNodeContents('nodeid', html, js); return true; @@ -325,7 +325,7 @@ Plugin page can listen to JQuery events that are triggered on successful update ```php $PAGE->requires->js_amd_inline(" require(['jquery'], function(\$) { - $('body').on('updatefailed', '[data-inplaceeditable]', (e) => { + $('body').on('event:core/inplace_editable:updateFailed', '[data-inplaceeditable]', (e) => { // The exception object returned by the callback. const exception = e.exception; @@ -337,7 +337,7 @@ require(['jquery'], function(\$) { // Do your own error processing here. }); - $('body').on('updated', '[data-inplaceeditable]', (e) => { + $('body').on('core/inplace_editable:updated', '[data-inplaceeditable]', (e) => { // Everything that web service returned. const ajaxreturn = e.ajaxreturn;