Package: | Roo.data |
Defined In: | Roo/data/ScriptTagProxy.js. |
Class: | ScriptTagProxy |
Note that if you are retrieving data from a page that is in a domain that is NOT the same as the originating domain
of the running page, you must use this class, rather than DataProxy.
The content passed back from a server resource requested by a ScriptTagProxy is executable JavaScript
source code that is used as the source inside a <script> tag.
In order for the browser to process the returned data, the server must wrap the data object
with a call to a callback function, the name of which is passed as a parameter by the ScriptTagProxy.
Below is a Java example for a servlet which returns data for either a ScriptTagProxy, or an HttpProxy
depending on whether the callback name was passed:
boolean scriptTag = false;
String cb = request.getParameter("callback");
if (cb != null) {
scriptTag = true;
response.setContentType("text/javascript");
} else {
response.setContentType("application/x-json");
}
Writer out = response.getWriter();
if (scriptTag) {
out.write(cb + "(");
}
out.print(dataBlock.toJsonString());
if (scriptTag) {
out.write(");");
}
Options | Defined By | |
---|---|---|
callbackParam : String
(Optional) The name of the parameter to pass to the server which tells
the server the name of the callback function set up by the load call to process the returned data object.
(Optional) The name of the parameter to pass to the server which tells
the server the name of the callback function set up by the load call to process the returned data object. Defaults to "callback". The server-side processing must read this parameter value, and generate |
Roo.data.ScriptTagProxy | |
nocache : Boolean
(Optional) Defaults to true.
(Optional) Defaults to true. Disable cacheing by adding a unique parameter
name to the request. |
Roo.data.ScriptTagProxy | |
timeout : Number
(Optional) The number of milliseconds to wait for a response.
(Optional) The number of milliseconds to wait for a response. Defaults to 30 seconds.
|
Roo.data.ScriptTagProxy | |
url : String
The URL from which to request the data object.
The URL from which to request the data object.
|
Roo.data.ScriptTagProxy |
Method | Defined By | |
---|---|---|
new Roo.data.ScriptTagProxy
(Object config)
Create a new Roo.data.ScriptTagProxy
Create a new Roo.data.ScriptTagProxy
|
||
abort
()
Abort the current server request.
Abort the current server request.
|
Roo.data.ScriptTagProxy | |
Load data from the configured URL, read the data object into
a block of Roo.data.Records using the passed Roo.data.DataReader implementation, and process that block using the passed callback.
Load data from the configured URL, read the data object into
a block of Roo.data.Records using the passed Roo.data.DataReader implementation, and process that block using the passed callback.
|
Roo.data.ScriptTagProxy |