Cache of Spry.Utils.updateContent data?
So I have a need for a Tab system that pulls data from other
files to load into the tabs. Any links in those files will trigger
the file to load into the tab (think like an iframe, but no
iframes). If the link is to an external site it will work as
normal. The links in my outside files don't need any js, id or
class in them. Just normal html. With some help from the yahoo
event and dom library I was able to detect clicks and redirect
everything very nicely. Did I need to use YUI to do the event
listener? Not sure, it made it pretty easy and I am no JS expert. I
didn't see anything within spry to help in that regard.
Example Here:
http://dev.besavvy.com/Spry_P1_4_1214/samples/tabbedpanels/tabbed_panel_sample.htm
My trouble comes with caching of the files. It seems FF
caches my .html files but not .cfm ones. IE caches both. I can use
the cfheader tags to prevent the cache I am sure, but that doesn't
fix .html files. I know I can work around it but I wanted to check
here as I am not clear if there is an optional attribute or another
direction I should take. It would be very handy to have a :cache
true :cache false type of solution.
Try:
Spry.Utils.updateContent('apDiv1',elTarget,null,{method:'POST'});
which I believe will cause it to use the browsers post
mechanism which never caches.
Or:
var ts = new Date();
Spry.Utils.updateContent('apDiv1',elTarget+'&TS='+ts.toString());
which will add a unique date string to the end of the url
being requested making the browser believe it is a new page
Oh if the page doesn't already have a query string change +
'&TS=' to + '?TS='
Regards,
Chris Phillips
Senior Application Developer
www.dealerpeak.com
Similar Messages
-
Spry.Utils.updateContent & IE caching pls help
Hi -
so ive read quite a few posts about this problem but no
single - comprehensive solution. Basically im using updateContent
to show and refresh a mini basket display on my ecom site. works
great in firefox but in IE7 the shopping basket apparently gets
cached the first time it gets updated and and then only updates the
cached version thus making it appear as if you havent actually
added anything to your cart. I know it's a cache issue cause I
clear the cache, re-updateContent, and the most current basket
state renders.
It seems like this should be documented somewhere - hopefully
someone can offer up a straightforward solution.
Cheers
AndyHi Andy,
By default Spry.Utils.updateContent() uses the "GET" method
for requesting a fragment from the server. What this means is that
you are at the mercy of the Browser's caching system and the
caching rules specified for that fragment by the Web Server. IE6,
not sure about IE7, also had a bug where even though the server
says don't cache my page, IE still insists on caching the page ...
a workaround was to append a query param to your URL that made the
URL unique, for example the local time:
Spry.Utils.updateContent(ele, "myfoo.php?id=12&curTime="
+ Date.now(), myCallback);
The other workaround is to use the "POST" method. Most
browsers don't cache results from a "POST" because that is what
most web applications use to fetch data that changes.
Spry.Utils.updateContent(ele, "myfoo.php?id=12", myCallback,
{ method: "POST" });
--== Kin ==-- -
Append swf file - Spry.Utils.updateContent - not work
I don't understand this
When I try to add swf file to Spry Tabbed Panels content -
everything is OK. Now - in tabbed panels content I want to insert
data from external html files. In this external file I have swf
file and text, and images. When I preview this html external file
in browser - all data are displayed correctly. When I try append
this file into tabbed panels content :
<a href="#" onclick="Spry.Utils.updateContent('apDiv1',
'products/products1.htm'); return false;">Append file</a>
only swf file in a new window are display.
If I delete swf content from external html file - everything
is ok. But if in external append file is a swf content - IE display
only swf file.
Is there posible to append html file with swf file in this
method in any way?Hi Elaine,
The implementation of AC_FL_RunContent() suggests that it was
only meant to be run *BEFORE* the page finishes loading. Because
Spry data sets and regions load and redraw asynchronously, usually
*after* the page finishes loading, they are not compatible. As
we've mentioned above, if Spry triggers the call to
AC_FL_RunContent(), it will most likely be *after* the onload event
has fired, and since AC_FL_RunContent() uses document.write() it
will result in the entire page being overwritten by the
<object>/<embed> tag that it writes out.
That all said, libraries like SWFObject were designed to be
called even after the onload event fires, at least from what I can
tell from their samples. If you need to extract data from a data
set to create your SWFObject, you can simply attach an observer to
your data set that will tell the swfobject to do what it is you
want it to do. For example:
<script type="text/javascript">
var dsProducts = new Spry.Data.XMLDataSet("products.xml",
"/products/product");
// Register an observer on dsProducts so that any time it
changes data or the current
// row changes, it tells the swfobject what to do:
dsProducts.addObserver(function(notificationType, notifier,
data)
if (notificationType != "onDataChanged" || notificationType
!= "onCurrentRowChanged")
return;
// Do something with the swfobject here:
var curRow = dsProducts.getCurrentRow();
// The following embedSWF call is only an example of how to
get the "productURL" column
// value for the current row and pass it to the swfobject.
The rest of the args, are left as names to
// show you what you should be passing.
swfobject.embedSWF(curRow.productURL, replaceElemIdStr,
widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj,
parObj, attObj);
</script>
--== Kin ==-- -
Spry:state="loading" for Spry.Utils.updateContent
It would be very handy to be able to use something like
spry:state="loading" for Spry.Utils.updateContent. Right now it
seems you can only use the :state="loading" for regions. Makes
sense but being able to activate the loading div while update
content is running would also be very handy. To that matter for
waiting for tabs to load, etc.Cool. Thanks for the reference, Andrew!
-
NOTE THAT THIS ONLY PERTAINS TO MOBILE VIEWING (tested on iPhone)
Hi, I have a SpryTabbedPanels widget within my index.html page, where clicking each tab calls Spry.Utils.updateContent() to load an html fragment into the body of the panel content. My index.html looks something like...
<html>
<head>
<!-- All the Spry includes are done here but left out for brevity -->
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<p>This is text that is effected by stylesheet.css</p>
<!-- The Spry tabbed panel widget is invoked here, but only the following line is pertinent -->
<li class="TabbedPanelsTab" tabindex="0" onclick="Spry.Utils.updateContent('frag','frag.html');">Code Fragment</li>
<!-- The rest of the code to close up the tabbed panels widget goes here -->
</body>
</html>
Then the frag.html code can be anything, and here I'll just say it's...
<p>This is a code fragment not affected by stylesheet.css</p>
Suppose then that I have the following style sheet called stylesheet.css...
p {
color:#FF0000;
If index.html is accessed in a web browser like Chrome, Safari, etc., this code will have the obvious effect of displaying:
This is text that is effected by stylesheet.css
This is a code fragment not affected by stylesheet.css
However, when mobile browsing, the style sheet is not carried over to the code fragment, so the default settings for the <p> tag are used, producing black text for the second sentence above, displaying:
This is text that is effected by stylesheet.css
This is a code fragment not affected by stylesheet.css
I've tried putting <html> and <head> tags with a link to stylesheet.css in frag.html, but nothing seems to work. Any help would be greatly appreciated!
ThanksI think that worked. I've been messing around for a long time trying to
figure it out myself watching tons of drop down tutorials. Should have
asked a long time ago... It was hard because I wasn't completing from
scratch and rather updating my current site. How could I give you the
location on the server easily?
Lamppa Manufacturing Inc.
Kuuma (Green) Furnaces & (Fantastic) Sauna Stoves
P.O.Box 422
Tower, MN 55790
www.lamppakuuma.com
facebook<http://www.facebook.com/pages/Lamppa-Manufacturing-Incorporated-Kuuma-Furnaces-Sauna-Stove s/215958785138157>
[email protected]
1-800-358-2049
218-753-2330 -
Spry.Utils.updateContent()
I wonder if there is a way to evaluate the scripts contained
in a request using updateContent()?. I've been looking for the
answer with no success, can any one point me to the answer or tell
me if it can be done?
Cheers, Ivan.Forget this post, i've seen the change log for Spry
PreRelease 1.4 and since then Spry.Utils.updateContent(), dependant
of Spry.Utils.setInnerHTML(), evaluates any script.
Thanks anyway -
Spry tabs loading data onClick
We want to use the Spry tabs, but we have tons of data that
will be on each tab. We do not want to have to load all that data
when the tab structure loads when they possibly won’t be
clicking on every tab. What is the best way to do this where the
data in the tab is retrieved and loaded ONLY when they click the
tab?Hi ehaemmerle,
We currently don't have any facilities built-into the
TabbedPanels widget to aid in delayed panel content loading, but
you could do something like this:
<script>
var gPanelURLS = [
"foo.php?panelID=0",
"foo.php?panelID=1",
"foo.php?panelID=2",
function LoadPanelContent(ele)
var i = TabbedPanels1.getTabIndex(ele);
var url = gPanelURLS [ i ];
var tabContentPanelEle = TabbedPanels1.getContentPanels()[ i
if (url && tabContentPanelEle)
Spry.Utils.updateContent(tabContentPanelEle, url);
</script>
<div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGroup">
<li class="TabbedPanelsTab"
onclick="LoadPanelContent(this);">Tab1</li>
<li class="TabbedPanelsTab"
onclick="LoadPanelContent(this);">Tab2</li>
</ul>
<div class="TabbedPanelsContentGroup">
<div class="TabbedPanelsContent"></div>
<div class="TabbedPanelsContent"></div>
</div>
</div>
Of course, you'll have to either force the default tab to
load when the page is loaded, or embed your default tab content in
your page.
--== Kin ==-- -
Spry Tabbed XML data panels within HTMLPanel not working.
Many thanks for reading.
s
I trying to provide a rapid solution using adobe's samples
to make Spry Tabs work within an html panel (in order to avoid
many links in my page).
I am using the following code:
initial page with html panel with the ready products.js to parse the links:
<script src="../SpryAssets/xpath.js" type="text/javascript"></script>
<script src="../SpryAssets/SpryData.js" type="text/javascript"></script>
<script src="../SpryAssets/SpryPagedView.js" type="text/javascript"></script>
<script src="../SpryAssets/SpryDOMUtils.js" type="text/javascript"></script>
<script src="../SpryAssets/SpryHTMLPanel.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript" src="../SpryAssets/SpryDataExtensions.js"></script>
<script src="SpryNestedXMLDataSet.js" type="text/javascript"></script>
<script src="../SpryAssets/products.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="TabbedPanels/SpryTabbedPanels.css"/>
<script src="TabbedPanels/SpryTabbedPanels.js"></script<script type="text/javascript">
var ds1 = new Spry.Data.XMLDataSet("ajaxbibliaxmlbridgetitle.php", "root/row[katigoria=1]", {sortOnLoad: "ID_BIBLIOU", sortOrderOnLoad: "ascending"});
var pv1 = new Spry.Data.PagedView( ds1 ,{ pageSize:10 });
var pv1PagedInfo = pv1.getPagingInfo();
//var TabbedPanels1 = new Spry.Widget.TabbedPanels();
</script>
</head>
<body class="twoColFixRtHdr">
<div id="container">
<div id="sidebar1">
<div id="productPageLinks">
<ul>
<li><a href="index.php">Index</a></li>
<li><a href="booklist.php">Product List</a></li>
<li><a href="test.php">Σχετικά με τη Βιβλιοθήκη</a></li>
</ul>
</div>
</div>
<div id="mainContent">
<br />
<div class="HTMLPanelLoadingContent"> Waiting</div>
<div class="HTMLPanelErrorContent"> error </div>
</div>
</div>
</body>
</html>
Products.js (adobe'S change to can load xml dataset)
var mainPanel = null;
// Our initialization function which unobtrusively attaches
// click handlers on the product links within the page.
function InitProductPage()
mainPanel = new Spry.Widget.HTMLPanel("mainContent" , { evalScripts: true });
var observer = {onPostUpdate: function(){ Spry.Data.initRegions('mainContent');
mainPanel.addObserver(observer);
// For every link on the page which points to a product page,
// attach an onclick handler that will intercept clicks and
// and fire off a request to load the URL via the HTMLPanel.
// For these links, we want to load the static product page
// and extract out the content underneath the "mainContent"
// node.
Spry.$$("#productPageLinks a").addEventListener("click", function(e)
mainPanel.loadContent(this.href, { id: "mainContent" });
return false;
}, false);
// For every link on the page which points to a product HTML
// fragment, attach an onclick handler that will intercept clicks and
// and fire off a request to load the URL via the HTMLPanel.
// For these links, we are loading HTML fragments, so there is no
// need to specify an ID to extract out. The HTMLPanel will insert
// all of the content recieved.
Spry.$$("#productFragmentLinks a").addEventListener("click", function(e)
mainPanel.loadContent(this.href);
return false;
}, false);
// Add our InitProductPage() function as a load listener
// so that it gets executed once the page has fully loaded.
Spry.Utils.addLoadListener(InitProductPage);
XML data and stuff all loaded correctly
What I am trying to do is to load a second page from a link in my initial page
that contains a Tabbed Panel.
The page loads but no panel functionality exists. The first Panel load correctly but behaves as a simple html page .
I have searched several hours the forums and playing around by moving the definition of Spry.Widget.TabbedPanels within
the initial HTMLPanel page and other spots but this produced js errors as expected (because the tab panel definitions exist in bookcategories.php)
which is loaded only when it is called.
Any ideas?
Page to load is like this :
<bookcategories.php>
<link rel="stylesheet" type="text/css" href="TabbedPanels/SpryTabbedPanels.css"/>
<script src="TabbedPanels/SpryTabbedPanels.js"></script>
<script language="JavaScript" type="text/javascript" src="../SpryAssets/SpryDataExtensions.js"></script>
</head>
<body >
<div id="container">
<div id="mainContent">
<div class="TabbedPanels" id="TabbedPanels1">
<ul class="TabbedPanelsTabGroup">
<li class="TabbedPanelsTab">SOmething ... </li>
<li class="TabbedPanelsTab">Something else </li>
<
</ul>
<div class="TabbedPanelsContentGroup">
<div class="TabbedPanelsContent">Blah Blah
<div spry:region="pv1" id="bibliapv"><br />
<br />
<div spry:state="ready">
<table width="775" height="42" >
<tr style="color:#900"; >
<th etc>
</tr>
<tr spry:repeat="pv1" spry:even="even" spry:odd="odd">
<td > {ID_}
</td>
<td>{Writer}</td>
<td>{Book_Title}</td>
</tr>
</table>
</div>
</div>
<div class="TabbedPanelsContent">Tab 2 Content</div>
<div class="TabbedPanelsContent">Tab 3 Content</div>
<div class="TabbedPanelsContent">Tab 4 Content</div>
</div>
</div>
</div>
<br class="clearfloat" />
</div>
<script type="text/javascript">
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");
</script>
</body>
</html>
Many thanksOk I went back through everything and checked to make sure my
files were in the right places both my SpryTabbedPanels.css and my
SpryTabbedPanels.js are in the SpryAssets folder and they work fine
until I try and add data from an xml file to them then the tabs
populate with the info but become unclickable and the content area
has every bit of content in on tab. Below is what I have let me
know what I'm doing wrong I am using Spry 1.6
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml"
xmlns:spry="
http://ns.adobe.com/spry">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<title>Untitled Document</title>
<script src="SpryAssets/xpath.js"
type="text/javascript"></script>
<script src="SpryAssets/SpryData.js"
type="text/javascript"></script>
<script src="SpryAssets/SpryTabbedPanels.js"
type="text/javascript"></script>
<script type="text/javascript">
<!--
var ds1 = new Spry.Data.XMLDataSet("solutions3.xml",
"solutions/solution");
//-->
</script>
<link href="SpryAssets/SpryTabbedPanels.css"
rel="stylesheet" type="text/css" />
</head>
<body>
<div spry:region="ds1">
<div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGroup">
<li spry:repeat="ds1" class="TabbedPanelsTab"
tabindex="0">{name}</li>
</ul>
<div class="TabbedPanelsContentGroup">
<div spry:repeat="ds1"
class="TabbedPanelsContent">{desc}</div>
</div>
</div>
</div>
<script type="text/javascript">
<!--
var TabbedPanels1 = new
Spry.Widget.TabbedPanels("TabbedPanels1");
//-->
</script>
</body>
</html> -
Spry.Utils.loadURL headers problem
I am posting a request with the loadURL function.
I am getting two values from a form :
- a WYSIWYG texarea editor which id is 'elm1'
- an input text field 'contentfilename'
In my textarea, I wrote a phone number that have the
following cars : +33
My PHP script that receive the posted data ($_POST variables)
don't receive the '+' cars.
Why is that ??
Here is my save function :
function saveEditorContent() {
var dataString = "elm1="+
tinyMCE.getInstanceById('elm1').getHTML()
+ "&contentfilename=" +
document.getElementById('contentfilename').value
var options = {
postData: dataString,
headers: {"Content-Type":
"application/x-www-form-urlencoded; charset=ISO-8859-1" },
errorCallback: saveEditorError
var url = "editorAction.php?action=savecontenteditor";
var req = Spry.Utils.loadURL( "POST", url, true,
saveEditorSucess,options );
removeMCE('elm1');
spEditor.showPanel( 2 ) ;
function saveEditorSucess(req) {
Spry.Utils.setInnerHTML('statusMessageBox',
'SUCCESS<br/>'+req.xhRequest.responseText );
Thank you
CorentinHello,
You miss a step in this code. You'll have to URI encode every
value you will send to the browser. In your situation the + in the
phone has a special meaning in the URI encoding and will be treated
as a blank space.
Please modify the following line:
var dataString = "elm1="+
tinyMCE.getInstanceById('elm1').getHTML()
+ "&contentfilename=" +
document.getElementById('contentfilename').value
with this one:
var dataString = "elm1="+
encodeURIComponent(tinyMCE.getInstanceById('elm1').getHTML())
+ "&contentfilename=" +
encodeURIComponent(document.getElementById('contentfilename').value);
Regards,
Cristian -
Spry.Utils.loadURL problem with IE7
Hello there. First of all sorry for my english.
I have a problem with Spry.Utils.loadURL function in Internet
Explorer 7 only. In firefox works fine.
So i have an asp file that returns a string with some stuff.
I load this asp file with Spry.Utils.loadURL like this.
function ReLoadExtras() {
var req = Spry.Utils.loadURL("GET",
"ControlExtras.asp?type=get&id=50", true, MySuccessCallback);
function MySuccessCallback(req) {
Spry.Utils.setInnerHTML('Extralist',
req.xhRequest.responseText);
In interner explorer works fine only at the first page load.
I have a button that fires the ReLoadExtras() function. But if i
hit it again to reload the div's content return nothing or returns
the same string. The string that ASP file returns is a value from
database but if i change this value on the database and hit the
button again i get the previus value. I think that something is
going wrong with the internet explorer's cache. I'm going crazy
because in firefox works without any problem.
Anynone who can help :-)Finally i fixed this problem. The problem was Internet
Explorer's cache. Every time that i call the asp file i have to
make the url unique. So i create a function that creates a unique
url.
function ReLoadExtras() {
var url =
"ControlExtras.asp?ControlExtras.asp?type=get&id=50";
var req = Spry.Utils.loadURL("GET", MakeUniqueQuery(url),
true, MySuccessCallback);
function MySuccessCallback(req) {
Spry.Utils.setInnerHTML('Extralist',
req.xhRequest.responseText);
function MakeUniqueQuery(x) {
var temp = Math.random() * 3;
var tempurl = x + "&sid=" + temp;
return tempurl;
} -
Spry.Utils.loadURL problem
I'm having trouble with the last parameter of
Spry.Utils.loadURL.
I know I need more info in the last argument but I cannot
find good documentation on this. I can work out how to do it with
form data, but not with data passed as a simple variable parameter.
ANY help appreciated!
In the code snippet below I am trying to pass a value to
Spry.Utils.loadURL that will them be passed to resfunc as request.
But I cannot work out how to do this.
The function that calls Spry.Utils.loadURL works ok., I test
that it is receiving the correct value by using alert(value). But
how do I get this value into the argument list of
Spry.Utils.loadURL so I can display it?
function doFormPost(url,photoId,resfunc) {
formData = encodeURI(photoId);
Spry.Utils.loadURL('POST', url, true, resfunc,
{"Content-Type": "application/x-www-form-urlencoded;
charset=UTF-8"});
function resFunc(request) {
var mydiv = document.getElementById("foo");
var result = request.xhRequest.responseText;
$("result").innerHTML = "Result was: " + result ;
mydiv.innerHTML = result;
function HandleThumbnailClick(id, photoId)
StopSlideShow();
doFormPost('moon.cfm', photoId,resFunc);
dsPhotos.setCurrentRow(id);
ShowCurrentImage();Hi Kate,
I think what you are trying to do is this:
function doFormPost(url,photoId,resfunc) {
// URL encode the photoId value.
formData = encodeURI(photoId);
// Build the headers object *outside* of the loadURL call to
reduce *visual* confusion.
// All we want to do here is to make sure that when we make
the request, that the browser also
// tell the server that the data we are sending in postData
is url encoded.
headers = {};
headers['Content-Type'] = "application/x-www-form-urlencoded;
charset=UTF-8";
// Send the post request, making sure to pass the content
type header and formData in the options object.
Spry.Utils.loadURL('POST', url, true, resfunc, { headers :
headers, postData: formData });
The 5th argument loadURL is an options object. You can
specify the named properties on this object that you want, for
example "headers" and "postData". The names of the option
properties you can specify are:
username - String that specifies the username on the server
to use when making the request.
password - String that specifies the password to use when
making the request.
postData - URL encoded string of name value pairs. Used when
the request is made with "POST".
errorCallback - Function to call if an error comes back from
the server after the request is made.
headers - Object that allows the caller to send additional
HTTP headers with the request. The properties on this object are
the named after the HTTP property. The value for the property is
the value to send. For example if you wanted to send this HTTP
property as part of the request header:
Content-Type: application/x-www-form-urlencoded;
charset=UTF-8
You would add this to your options object:
headers: { "Content-Type":
"application/x-www-form-urlencoded; charset=UTF-8 }
userData - This is anything you want to pass into loadURL. It
will be stored on the request object so that when your
successCallback/errorCallback is triggered, you can access it. For
example:
var myString = "This is a test!";
function myCallback(request)
alert(request.userData); // Alerts with the string "This is
a test!"
Spry.Utils.loadURL("POST", url, true, myCallback, { headers:
headers, postData: formData, userData: myString });
I realize this is annoying that it isn't documented
extensively. We are working on it.
--== Kin ==-- -
Spry.Utils.setOptions
I'm creating an object with spry as a property...i want to
trigger the loading of the spry myself so i rely on setting up the
spry data set manually and triggering the loadData
can you use setOptions to
quote:
Spry.Utils.setOptions({subPaths: 'parm/value'})
and other variables as necessary?Spry.Utils.setOptions() is defined in SpryData.js ...
including that file should get rid of the error.
--== Kin ==-- -
Requesting new methods for Spry.Utils. Notifier
I'm building a quiz application with Spry that is based on a
frameset. The main DataSet is contained in the frameset page, and
it swaps in different question type templates in a child frame.
Each of these templates creates NestedXMLDataSets and has Spry
Regions.
When re-using the same template twice in a row, IE will throw
a freed script error, because the objects held by the observer in
the main frame are still in memory, but the page they came from is
gone. (Firefox will work if you remove the Nested Data Set from the
observer list, apparently replacing a spry region with itself is
ok. I'm assuming since the new region is identical to the old one,
the newly loaded page occupies the same space in memory as the old
one, so everything just works as if it were 'new'.)
The solution, therefore, is to remove any observers from the
DataSet in the main frame, that live in the templates in the child
frames.
However, since the region is assigned as an observer
automatically, I have no way of knowing which position it occupies
in the observers array, or how to reference it. So, in order to
remove it, I have to access parent.myDS.observers directly, and
remove all observers but the first. (Knowing that the first
observer on the list is one I manually added and need to persist.)
Bascially, what we need is a method to ID and remove regions
from the observer list, in those cases where a region (and page
containing it) are going to be destroyed but the data set it
populates from persists.
e.g. <spry:regionid="foo">
Also, since there are other objects like Nested Data Sets
that automatically get added to the observer list, it would be nice
to be able to inspect the list.
e.g.: myDataSet.getObservers()
Sorry if this doesn't make much sense, I'm on a lack of sleep
and burned out from debugging at the moment. I'd love to help the
Spry team continue to refine the product because I think it's
great, and in practice, for the most part, it's made developing
RIA's such as e-Learning applications that have to rely on static
XML much much easier.PaulColombo wrote:
> Bascially, what we need is a method to ID and remove
regions from the observer
> list, in those cases where a region (and page containing
it) are going to be
> destroyed but the data set it populates from persists.
> e.g. <spry:regionid="foo">
You don't need to know the index in the observers array to be
able to remove one, you do how ever need to have a reference to the
object doing the observing to be able to remove it. Each data set
inherits the methods of the Notifier object, so your dataset has a
removeObserver method, so pass in the object doing the observation,
like so:
myDataSet.removeObserver(observerObj);
I've not delved too much into the datasets, so with auto
added observers, not quite sure what the observer is that needs to
get removed, but if you can figure it out you can use
removeObserver();
> Also, since there are other objects like Nested Data
Sets that automatically
> get added to the observer list, it would be nice to be
able to inspect the list.
>
> e.g.: myDataSet.getObservers()
You already have direct access to the observers array with
myDataSet.observers, what do you get by having a method rather
direct access? Regardless, you can add that method yourself to the
Notifier object and it'll get automatically added to your datasets:
Spry.Utils.Notifier.prototype.getObservers =
function(observer)
return this.observers;
Danilo Celic
|
http://blog.extensioneering.com/
| WebAssist Extensioneer
| Adobe Community Expert -
Spry.Utils.removeAllChildren
The Spry.Utils.removeAllChildren function is defined in the
1.5 API but I can't find it anywhere in the spry js files. Also,
when I try to use it per the docs I get a
Spry.Utils.removeAllChildren is not a function error.Hello,
I don't know yet the full reasons but this function was
removed in Spry 1.5. The API documentation unfortunately was not
updated yet to cover this change.
The old function looked like this in Spry Data:
Spry.Utils.removeAllChildren = function(node)
while (node && node.firstChild)
node.removeChild(node.firstChild);
in case you depend on its behavior and you like to include in
your page.
Cristian -
Spry.Utils.loadURL - IE7
I built a pre-loader that uses loadURL to complete 35 tasks.
After a task completes it updates the screen asynchronously with
the % completed. It works in Firefox every time, but always fails
in IE7 at 84%. In other words, after a specific amount of time IE7
seems to bail. When IE7 bails all unfinished tasks trigger the
error callback, but req.xhRequest.statusText is empty.
For the sake of debugging all tasks are the same. If I reduce
the number of tasks it will complete in IE7.
So it seems quite clear there are no specific code issues.
The debugger shows no errors. Basically, in IE7 after a certain
amount of time the connections are just lost.
I have such a huge time investment in this software that this
is a huge nightmare. I didn't notice the problem until after
everything was done.
Does any know if there is a client side timeout in IE7? Its
seems that is what is happening. I would appreciate to hear anyones
ideas.This is what my test case looks like:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<title>LoadURL Test 01</title>
<link href="../samples.css" rel="stylesheet"
type="text/css" /><br />
<script type="text/javascript"
src="../../Spry/includes/xpath.js"></script>
<script type="text/javascript"
src="../../Spry/includes/SpryData.js"></script>
<script type="text/javascript">
var dsStates = new
Spry.Data.XMLDataSet("../../Spry/data/states/states.xml",
"/states/state");
function DoTest()
var context = new Object;
context.data = dsStates.getData();
context.index = -1;
LoadNextURL(context);
var gLock = 0;
function LoadNextURL(context)
var rowIndex = ++context.index;
var count = context.data.length;
var row = context.data[ rowIndex ];
if (rowIndex >= count)
Spry.$("status").innerHTML = "Done";
return;
var url = "../../Spry/data/states/" + row.url;
Spry.$("status").innerHTML = "Loading (" + (rowIndex + 1) +
" of " + count +") " + url + " ...";
if (gLock)
Spry.Debug.trace("WARNING: Re-entering lock! " + gLock);
++gLock;
if (Spry.$("forceAsync").checked)
setTimeout(function() { Spry.Utils.loadURL("GET", url, true,
LoadCallback, { userData: context, errorCallback: LoadErrorCallback
}); }, 0);
else
Spry.Utils.loadURL("GET", url, true, LoadCallback, {
userData: context, errorCallback: LoadErrorCallback });
--gLock;
function UpdateProgressBar(percent)
var ele = Spry.$("progressBar");
var width = ele.offsetWidth * percent;
ele.getElementsByTagName("*")[ 0 ].style.width = percent +
function LoadCallback(req)
var context = req.userData;
var currentIndex = context.index;
var count = context.data.length;
UpdateProgressBar(((currentIndex+1) / count) * 100);
LoadNextURL(context);
function LoadErrorCallback(req)
var context = req.userData;
Spry.$("errors").innerHTML += "Failed to load " +
context.data[ context.index ].url + "<br />";
LoadNextURL(context);
</script>
<style type="text/css">
.ProgressBar {
width: 200px;
height: 16px;
border: solid 1px black;
padding: 0px;
position: relative;
margin: 4px;
overflow: hidden;
.ProgressBarStatus {
position: absolute;
height: 16px;
width: 0px;
background-color: #3399FF;
</style>
</head>
<body>
<div spry:region="dsStates">
<p spry:state="loading">Loading states.xml file
...</p>
<div spry:state="ready">
<p>Total of {ds_RowCount} rows loaded. <input
type="button" value="Start Test" onclick="DoTest();" />
<label>Force Async Requests: <input type="checkbox"
id="forceAsync" /></label></p>
<div id="progressBar" class="ProgressBar"><div
class="ProgressBarStatus"></div></div>
<div id="status"></div>
</div>
<div>
<p id="errors"></p>
</div>
</div>
</body>
</html>
--== Kin ==--
Maybe you are looking for
-
Is there a way to manually adjust the vertical zoom in the keyframe editor?
I often want to zoom in on a particular set of keyframes so that I can adjust them, but there seems to only be options for horizontal zoom and autozoom. Is there a way to adjust the vertical zoom?
-
Downloading a trial Adobe Edge Animate app
How to download a trial Adobe Edge Animate app? I logged in to creative cloud account. In Adobe Application Manger, I can't find the Edge Animate download button? Where can I find the download for adobe edge animate? I am attaching an image of Adobe
-
Many original dates of photos are missing or wrong
I have had a lot of issues with my iPhoto program. After many trips to the Genius Bar and numerous hours with phone techs, I am now rebuilding my library, starting with a backup of it from before the corruption. When I "get info" of a picture, I noti
-
I have purchased Adobe CC for Team and have not been able to complete the Adobe CC Desktop manager installation. I get the error code A12E6. I have gone throught the Adobe Online Chat Support but they were unable to figure it out. We went through cle
-
I have found that it is time to update my router and I would like some help in determining the best router for my needs. I consider myself a novice in this subject but have read some about routers. However, I'm stuck. My family and I live in a two st