Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make AJAX based GUI using Zend Framework
    primarykey
    data
    text
    <p>I have a application built using Zend Framework. I have decided to go with JQuery instead of Dojo. I do use the ZendX helpers for stuff like ajaxLinks and dialogContainers. I want to try and make the GUI as AJAX driven as possible. But I struggle with deciding on what I feel is the best approach. Most of the time it's a matter of loading a "page" into a dialogContainer instead of reloading the entire page. So that you for instance get a dialog containing a form for changing some user data or something similar.</p> <p>At first I returned the entire page but if it was requested using an AJAX request it used a different layout template to avoid all unenecerry javascript inclusions etc. This enabled my to build one version of a page that would basicly be browsable like normal AND via AJAX. But I haven't conviced myself that I like this. Looking at Zend Server GUI they seem to do this though and not return json encoded data and building the page from that.</p> <p>What would be the best approach for this and how should I handle javascript that is specific to the retrived page? I now have all the page specific javascript in the phtml file of that page.</p> <p>Another thing I'm concerned about is how to keep track of the resources created when opening a lot of dialog containers and populating them via ajax. Say we open one dialog and in that we get a list of items. If we click one yet another modal dialog container popsup for that specific item and is populated via ajax. But if the main page is never reloaded I can see this becoming hard to handle.</p> <p>Feels like I can't be the first one to wanna do an ajax driven UI so please point me in the right direction before I paint myself into a corner. ;)</p> <p>Update: I basicly tried all kinds of tutorials I could find on the context subject as well as the documentation at Zend. I think I must have missed to enable some undocumented feature or something. Since it didn't work I deleted the code, but trying to find the examples I looked at before I tried stuff like the bellow code.</p> <pre><code>$ajaxContext = $this-&gt;_helper-&gt;getHelper('AjaxContext'); $ajaxContext-&gt;addActionContext('list', 'html') -&gt;addActionContext('modify', 'html') -&gt;initContext(); </code></pre> <p>And I tried something like the following</p> <pre><code>$this-&gt;_helper-&gt;contextSwitch() -&gt;setContext('html', array( 'suffix' =&gt; 'html', 'headers' =&gt; array('Content-Type' =&gt; 'text/html; Charset=UTF-8'), ) ) -&gt;addActionContext('index', array('html','xml', 'json')) -&gt;setAutoJsonSerialization(true) -&gt;initContext(); </code></pre> <p>I tried adding other ActionContexts etc but no matter what all of them just ended up rendering the normal .phtml file all the time.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload