Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

add some info in docs on rendering custom-select loaded in with Ajax #4297

@frequent

Description

@frequent

I more or less got desperate trying to enhance a custom select menu pulled in via Ajax. The docs say forcing a rebuild can be done by

 $('select').selectmenu('refresh', true);

but while this seems to work with static content, dynamic elements don't play along (for example here, here ).

I tried to render a customselect which I had pulled in via Ajax. The only way it worked inside my success-handler is like this: :

var sel = $('.ui-page-active').find('select'),
wrapSel = $(sel).closest('.wrapper'),
newSel = $(sel)
    .clone()
    .attr('data-native-menu',false)
wrapSel.find('.ui-select').remove().end()
    .append( newSel );
newSel.closest('.ui-btn').trigger('create');

I have pretty much tried calling everything in the book on the wrapping ui-btn, ui-select and the select itself.

   selectmenu('refresh', true)
   selectmenu('refresh')
   selectmenu()
   trigger('refresh')
   page()

I could only get the Ajax-in select to render correctly with the above clone and split up order. Using any of the other methods or trying to chain breaks it again.

Not sure this really is a bug, but it sure is difficult and maybe deserves a look or some more info in the docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions