def destroy# ...apotomo_root.find_widget(:account_actions_dropdown).trigger(:update_current_account)respond_to do |format|format.json { render json: { message: message } }endend
$.ajaxurl: "#{@href.replace("#", "")}/all"type: "POST"dataType: "json"data:_method: "delete"ids: aSelectedall: all_selectedtext: textsuccess: (data) ->fieldsTable.fnDraw()hide_loading()$("html, body").animate({ scrollTop: $('.navbar-fixed-top')[0].offsetTop }, "slow");create_flash(data['message'])the goal is to delete elements from a DataTables table and redraw the table without having to refresh the page.We also need to update out navigation menu, this is where we are attempting to use Apotomo.class AccountActionsDropdownWidget < Apotomo::Widgethelper ApplicationHelperinclude Devise::Controllers::Helpershelper_method :current_userhelper_method :current_accounthelper_method :current_account_nameresponds_to_event :update_current_account, with: :update_current_accountdef displayputs 'Displaying'p current_accountrenderenddef account_required_actionsrender if current_accountenddef update_current_accountputs "Updating current account."replace state: :displayendprivatedef current_accountcurrent_user.try(:current_account)enddef current_account_namecurrent_account ? current_account.account_name : 'Account Name:'endendwhen following along in the logs are through debugger the display action is being rendered but the interface does not change.Updating current account.DisplayingAccount Load (0.6ms)# ActiveRecord output...Rendered app/widgets/account_actions_dropdown/account_required_actions.html.erb (13.6ms)Rendered text template (0.0ms)Rendered app/widgets/account_actions_dropdown/display.html.erb (19.0ms)Rendered text template (0.0ms)
--
Sie erhalten diese Nachricht, weil Sie Mitglied der Google Groups-Gruppe "Cells and Apotomo" sind.
Um Ihr Abonnement für diese Gruppe zu beenden und keine E-Mails mehr von dieser Gruppe zu erhalten, senden Sie eine E-Mail an cells-and-apot...@googlegroups.com.
Weitere Optionen: https://groups.google.com/groups/opt_out
http://localhost:3000/dashboard/render_event_response?source=twitter&type=submit&text=Hey
(from here)
replacing the necessary data (e.g. source=account and type=update_current_account).the logs show the puts statements:
Updating current account.DisplayingAccount Load (0.6ms)# ActiveRecord output...Rendered app/widgets/account_actions_dropdown/account_required_actions.html.erb (13.6ms)Rendered text template (0.0ms)Rendered app/widgets/account_actions_dropdown/display.html.erb (19.0ms)Rendered text template (0.0ms)
I've also tried replace view: :display
def destroy# ...apotomo_root.find_widget(:account_actions_dropdown).trigger(:update_current_account)respond_to do |format|
format.json { render json: { message: apotomo_root.page_updates.join("") } }endend