Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Something like this would work (to give a gmail style loading... message in the top right corner):</p> <pre><code>function useLoadingMessage(message) { var loadingMessage; if (message) loadingMessage = message; else loadingMessage = "Loading"; Dajaxice.preHook = function() { var disabledZone = document.getElementById('disabledZone'); if (!disabledZone) { disabledZone = document.createElement('div'); disabledZone.setAttribute('id', 'disabledZone'); disabledZone.style.position = "absolute"; disabledZone.style.zIndex = "1000"; disabledZone.style.left = "0px"; disabledZone.style.top = "0px"; disabledZone.style.width = "100%"; disabledZone.style.height = "100%"; document.body.appendChild(disabledZone); var messageZone = document.createElement('div'); messageZone.setAttribute('id', 'messageZone'); messageZone.style.position = "absolute"; messageZone.style.top = "0px"; messageZone.style.right = "0px"; messageZone.style.background = "red"; messageZone.style.color = "white"; messageZone.style.fontFamily = "Arial,Helvetica,sans-serif"; messageZone.style.padding = "4px"; disabledZone.appendChild(messageZone); var text = document.createTextNode(loadingMessage); messageZone.appendChild(text); } else { document.getElementById('messageZone').innerHTML = loadingMessage; disabledZone.style.visibility = 'visible'; } }; Dajaxice.postHook = function() { document.getElementById('disabledZone').style.visibility = 'hidden'; }; } </code></pre> <p>Call <code>useLoadingMessage()</code> from your javascript document.ready script, or from the onload in your body tag for the very agnostic.</p> <p>A couple of hacks in the <a href="https://github.com/jorgebastida/django-dajaxice/blob/master/dajaxice/templates/dajaxice/dajaxice.core.js" rel="nofollow">dajaxice.core.js</a>:</p> <p>Line 49 onwards:</p> <pre><code> oXMLHttpRequest.onreadystatechange = function() { if (this.readyState == XMLHttpRequest.DONE) { if(Dajaxice.postHook) Dajaxice.postHook(); if(this.responseText == Dajaxice.EXCEPTION || !(this.status in Dajaxice.valid_http_responses())){ error_callback(); </code></pre> <p>Line 65 onwards:</p> <pre><code> } if(Dajaxice.preHook) Dajaxice.preHook(); if(method == 'POST'){ oXMLHttpRequest.send(send_data); } else{ </code></pre> <p>The javascript is all library agnostic and it should only involve adding 2 lines to the Dajaxice source. If you wish to use a different loading element simply give it an <code>id</code> of <code>disableZone</code> in your html and set <code>visible = hidden</code> for its css.</p> <p>I took this solution from <a href="http://directwebremoting.org/dwr/documentation/browser/util/useLoadingMessage.html" rel="nofollow">dwr</a>, which is dajaxice for Java. It does have some other cool features though, like some decent debug pages and direct image uploading, which would be handy in dajaxice.... ;). </p>
    singulars
    1. This table or related slice is empty.
    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.
    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