Skip to content

Collapsible: refresh method missing #3771

phillpafford opened this Issue Mar 8, 2012 · 20 comments

jQM Docs say I should be able to update the layout on a collapsible

Trying to update the theme and collapsed data attributes and refreshing/updating the collapsible is not working



@gseguin gseguin was assigned Mar 9, 2012


First, thanks for the fiddle. It's rare and always appreciated.

In general we support this type of activity through refresh methods triggered through the plugin system:

$( "foo" ).collapsible( "refresh" );

The update layout is meant, I think, mostly for you to bind to to know when you should update custom widgets or components in the page. Not as a mechanism for telling our components to update. Though I can sympathize with the confusion.

To support this we'd have to add a refresh or collapse method to the widget and that's not likely to happen before 1.1 final.

@gseguin @toddparker

Feel free to weigh in here.


@johnbender Thanks for the update but to my knowledge there is no refresh method on collapsible:

Uncaught no such method 'refresh' for collapsible widget instance

And as for the update layout event I thought this was to tell other elements to adjust there size

can also manually trigger this updatelayout event to ensure components on the page update in response to the changes

Since I wanted to dynamically update the collapsible (collapsible state) and theme (Which the code updates just not the layout)



Correct on the first point, as I said:

To support this we'd have to add a refresh or collapse method to the widget and that's not likely to happen before 1.1 final.

As for the docs we should certainly clarify them.


Moving this to 1.2 because we should into adding this when we can.


@jakeboone02 - Maybe you can look at updating collapsibles and collapsible sets to use the API page style docs?


I'm on a business trip for the next few weeks but if I have some down time I'll see if I can sneak it in.

jQuery Foundation member
agcolom commented May 26, 2012

@phillpafford @toddparker : @jakeboone02 has updated the docs with the missing information on this. Are we now ok to close?

[EDIT]: Sorry, please ignore my comment... We still need the refresh method for the collapsibles....


Actually, something that does work is to run a $('#myCollapsible').trigger('click'); even though it is not as clean as a refresh would be, it produces the same result.


This falls within the on-the-fly options work, along with #4317.


Moving to 1.3

jQuery Foundation member

Moving to 1.4


Even .trigger('create') or ('refresh') does nothing to collapsibles.

When using collapsible('refresh') I get this error:

Uncaught Error: no such method 'refresh' for collapsible widget instance

jQuery Foundation member

Dynamically setting option "collapsed" has been fixed by commit 133c81a but we still need to add a refresh method.

Trigger "create" works on the container, but not on the element itself.
@gabrielschulhof @arschmitz - Is this a bug? I thought you could also trigger it on the element itself, but I also tested this with a listview and there it doesn't work either. So maybe I am wrong.

Update: I thought wrong... this is not a bug, but intentional.

Changing the title of this ticket (original: Can't set 'data-collapsed' and 'data-theme' dynamically).


'Pagecreate' would fix it? Honestly I didn't try. Another issue, adding listview dynamically to a static panel works with .trigger('pagecreate') but doesn't work with .listview('refresh').

Edit: updatelayout doesn't work either.


Is there any chance this method could be removed from the API docs until it is complete or have a warning beside it because im sure I'm not the only one scratching his head after copying directly from the API DOCs and still getting and error.


@cujomalainey have you tried trigger('create');?


@Palestinian Thanks, i read through the feed and must have missed that. That saves me a huge pile or work

jQuery Foundation member

closing this as fixed by widget review

@arschmitz arschmitz closed this Aug 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.