Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Collapsible: refresh method missing #3771

Closed
phillpafford opened this Issue · 20 comments
@phillpafford

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

Example:

Related:

@gseguin gseguin was assigned
@johnbender

@phillpafford

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.

@phillpafford

@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)

@johnbender

@phillpafford

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.

@toddparker

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

@toddparker

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

@jakeboone02

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.

@agcolom
Collaborator

@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....

@istrasoft

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.

@gabrielschulhof
Collaborator

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

@toddparker

Moving to 1.3

@arschmitz
Owner

Moving to 1.4

@Palestinian

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

http://jsfiddle.net/Palestinian/gMLsU/

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

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

@jaspermdegroot
Collaborator

Dynamically setting option "collapsed" has been fixed by commit 133c81a but we still need to add a refresh method.
See: http://jsbin.com/owasir/52/edit

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).

@Palestinian

'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.

@cujomalainey

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
@Palestinian

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

@cujomalainey

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

@arschmitz
Owner

closing this as fixed by widget review

@arschmitz arschmitz closed this
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.