Hi,
I had back-ported the collapsible fieldsets to 4.6, and haven't managed to test the final implementation in 4.7 yet, so maybe this issue has already been fixed in 4.7:
it annoyed me that the fieldsets were always closed after a page reload, so I made a few changes to collapse.js, so that now fieldsets that you open, will remain open when you return to that page.
The open fieldests are remembered in a cookie that is cleared when the browser is closed, and no changes are needed to anything besides collapse.js.
I attached the changed collapse.js in case it helps (needs proper testing though), or has this issue been handled already?
| Comment | File | Size | Author |
|---|---|---|---|
| collapse.js.txt | 2.11 KB | richardb |
Comments
Comment #1
nedjoGood idea. This isn't directly related to jstools since collapse.js is part of Drupal core. Do y ou want to move the issue to the Drupal project?
In jstools we are doing something similar with collapsiblocks.
Comment #2
Tobias Maier commentedmoving...
and a untested 1+ from my side...
Comment #3
moshe weitzman commentedcould we get a real patch? see http://drupal.org/diffandpatch
Comment #4
nedjoGood idea. We should however add cookie support in a general, reusable way. We could use the cookie setting and getting methods in jstools.js, see the Javascript Tools module. These methods are used to maintain collapse states over sessions in the collapsiblock module in Javascript Tools.
Comment #5
recidive commentedIt would be nice to have a common persistency mechanism that stores states in database instead of cookies. So all javascript widgets, core or not, will be able to use this for storing its states through AJAX calls. I saw a similar approach in Ruby on Rails, that uses the Scriptaculous library. All widgets/components in Scriptaculous have a
serialize()method that implodes their state in a query string ready to be used to call an AJAX handler that store the state. Like position (x,y) for Draggables.Comment #6
monkeybeach commentedJust tried the code above on 4.7 and it doesn't seem to work. Doesn't produce any warnings or errors in javascript console and I have cookies allowed.
Is it safe to assume the code is 4.6 only?
Comment #7
recidive commentedThis doesn't make sense because Drupal 4.6 doesn't have collapsible fieldsets.
Comment #8
monkeybeach commentedIt does in that context :)
However the code now works. I flushed the cookies and it worked fine. Stupid oversight of my own making ;-)
Comment #9
dmitrig01 commented4.6 no longer supported