I have created a nifty page adapting table-plus to show all the
datasets for an employee, with a checkbox next to each one that
indicates whether that dataset is part of the current project.
Last step is getting the checkbox to create or destroy the association
object in the join table (ProjectDataSets).
I am stuck on where to put in the create / destroy code. Using the
debugger, it seems ajax_updater is called only when the page is
rendered, not when the checkbox is clicked. But clearly something is
happening, since I'm getting a spinner...
Here's my tag (based on hobo's boolean-checkbox-editor):
<def tag="checkbox-association-editor" attrs="update, message"><%
raise HoboError.new("Not allowed to edit") unless can_edit?
f = ajax_updater(object_url(this_parent, :method => :put),
update,
:method => "put",
:message => message,
:spinner_next_to => Hobo.raw_js("this"),
:params => { this_parent.class.name.underscore => {
this_field => Hobo.raw_js('this.checked')
} })
%>
<input type="checkbox" value="1" onclick="#{f}" merge-attrs />
</def>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---