Drupal 7 API: Trigger views AJAX refresh via JavaScript or from PHP using ajax_command_invoke
Drupal 7 views.module allows to refresh ajaxified views
dynamically via a javascript call.
Implementation in JavaScript
The JavaScript call is simple:
- jQuery('.view-id-XXX').trigger('RefreshView');
Implementation in PHP
The AJAX refresh is even possible from PHP code, for example if you have an ajaxified form and want to refresh a view after it was saved, as the following examples show.
In an ajax callback function (..._ajax_callback):
OR
Julian Pustkuchen, M. Sc. Wirtschaftsinformatik ist passionierter Software- & Webentwickler mit den Schwerpunkten Softwaredesign, Objektorientierung sowie Usability- & Ablaufoptimierung bei webks. Ein weiterer Schwerpunkt ist die Entwicklung im CMS Drupal.
Entwickelt Julian gerade keine Software, fährt er Ski, Mountainbike, spielt Badminton, segelt oder verbringt Zeit mit Freunden.
Dieser Blog dient als sein "öffentlicher Notizblo(ck/g)".
Euch gefällt mein Blog?
Vielleicht hilft mir auch ein Buch, euch zukünftig (noch) bessere Artikel zu bieten? (Amazon Wunschliste)
Gerne bewerte ich auch ab und zu einmal unabhängig ein Produkt.
Ich freue mich über jede Art der Unterstützung in Form von Kommentaren, Lob oder Kritik.
Auf zum Kontaktformular!
Zu meinem Google+ Profil
Webbasierte Lösungen? Machen wir!
webks: websolutions kept simple
http://www.webks.de
Tags in Blogeintrag - Kategorie
Dir hat dieser Beitrag viel Zeit und Nerven gespart?
Dann freue ich mich über jede kleine Anerkennung:
Oder du suchst weitere professionelle Unterstützung?
Dann bietet dir unser webks.de Softwareentwickler-Team professionelle Dienstleistungen im Web-Development und der Drupal CMS Entwicklung!
Kommentare
PS: The best solution for
PS: The best solution for AJAXified entity forms (nodes, ...) is this, because it already handles several typical problems out of the box:
https://www.drupal.org/project/ajax_form_entity
Can a form have multiple ajax
Can a form have multiple ajax callback functions? What is best way to invoke contributed module ajax callback ?
Thanks,
I have tried ajax form entity module
I want to attach or embed a node form to a view and submit the form via ajax and the view must also refresh via ajax in realtime. I have tried ajax form entity module. It is working, but I want some flexibility. Can you help? I have also asked a question on statckexchange. I cannot post link here so pasting it like this /questions/238447/attach-or-embed-node-add-form-to-a-view
Kommentar hinzufügen