Dynamic Web Development with Seaside

21.6.2Callbacks Redux

AJAX with jQuery

ToDoListView>>renderHeadingOn: html

| helpId |
helpId := html nextId.
(html heading)
class: 'helplink';
onClick: ((html jQuery id: helpId)
slideToggle: 1 seconds);
onClick: ((html jQuery ajax)
id: helpId;
callback: [visible := visible not]);
with: self model title.
(html div)
id: helpId;
class: 'help';
style: (visible ifFalse: ['display: none']);
with: 'The Enhanced ToDo application.'
ToDoListView>>renderItem: anItem on: html

(html listItem)
passenger: anItem;
class: 'overdue' if: anItem isOverdue;
class: 'done' if: anItem isDone;
with:
[(html checkbox)
onChange: (((html jQuery id: listId) load)
serializeForm;
html: [:ajaxHtml | self renderItemsOn: ajaxHtml]);
value: anItem done;
callback: [:value | anItem done: value].
(html span)
script: ((html scriptaculous inPlaceEditor)
cancelControl: #button;
triggerInPlaceEditor: [:value | anItem title: value];
callback: [:htmlAjax | htmlAjax render: anItem title]);
with: anItem title. "<-- added"
html space.
(html anchor)
callback: [self edit: anItem];
with: 'edit'.
html space.
(html anchor)
callback: [self remove: anItem];
with: 'remove']
§
Enhanced ToDo Application
Drag and Drop
Adding an Effect
This is a draft chapter.

Copyright © 19 March 2024 Stéphane Ducasse, Lukas Renggli, C. David Shaffer, Rick Zaccone
This book is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 license.

This book is published using Seaside, Magritte and the Pier book publishing engine.