On the browse page, I show a list of dates for the occurrence of a periodic event, and statistics calculates the versts of all dates, such as max, min and the average interval between consecutive dates.
I use the best_in_place stone to allow in-place date editing. However, every time the date changes, statistics must be calculated and re-displayed from the server.
How to connect the callback function to the completion of editing best_in_place so that statistics can be displayed again?
This is my Rails code in show.html.erb
<td id="event_date">
<%= best_in_place @event, :occur_date %>
</td>
which in html is equal
<td id="event_date">
<span class='best_in_place' id='best_in_place_event_132_occur_date' data-url='/events/132' data-object='event' data-attribute='occur_date' data-type='input'>2012-03-23</span>
</td>
I tried the following coffee script code:
jQuery ->
$("#best_in_place_event_*_occur_date").live 'ajax:complete', (evt, data, status, xhr) ->
alert "a date has changed"
This does not work, nothing happens after I edited the date (event_date).
- , best_in_place?