Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Detect the state of Spry Effects

Posted on 2010-09-02
3
Medium Priority
?
470 Views
Last Modified: 2013-11-11
Hi Everybody

How can one detect the current state of a Spry effect (for example the slide effect)?
The problem seems to be that the state of the slide effect is lost when a page is refreshed or called newly after the slide effect has been executed. That leads to a problem when the effect is setup to allow "toggle". Example:

I slide down an initially invisible table by hitting the "hide/show" button. The table appears but contains a "next 25 items" button which refreshes the page to show the next 25 items pulled from a database. Now, if I hit the "hide/show" button again to toggle the table away (hide) again, the button, instead of sliding the table back up again, actually executes the initial effect of sliding it down (because after the page refresh it was initiated to the original state which is "up".

How can I make the spry slide effect "remember" the last state of the effect after the page is refreshed. Is there a way I can hand the state over to the next page by means of a variable, or ist there a way I can have the next page read out the last state of the slide effect?

Thanks for the help.
0
Comment
Question by:ichauch
  • 2
3 Comments
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 375 total points
ID: 33590579
You could use a server-side script (PHP or ASP) and store the state of the widget in a session variable and echo that back.  How is the "Next 25" button doing its thing?  If it is a form submit, you could capture that with Spry and not refresh the page and instead just refresh the data...that would prevent the other widgets from resetting to their onload states.
0
 

Author Comment

by:ichauch
ID: 33592982
Hi Jason. Thank you for your input. I have indeed in the meantime resolved the problem with a little piece of PHP code which simply replaces the desired Spry commands in the generated page depending on the data displayed in the table. Admittedly not the most elegant solution since it does refresh the whole page, it but works solidly and avoids adding/modifying the JS in the page. No other widgets or effects are being used so that I don't have to take them into account. But again, it could have been done more elegantly for sure.
Thanks again.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 33593254
Elegance can be overrated.  If it works, it works.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question