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.

controlgroups not getting enhanced because pagecreate handler is in mobile.init? #4773

Closed
@frequent

Description

@frequent

I'm doing a site using requireJS for on-demand loading with requireJS, Jquery and Jquery Mobile being the main plugins being required.

Ever since I got requireJS to work properly, I started having problems with controlgroups not being enhanced anymore. The elements contained enhanced, but a 4-button controlgroup would be 4 individual buttons with the wrapping controlgroup-div not being enhanced.

If I load page "straight" the first load usually works but on all subsequent pages being pulled in, all controlgroups are broken. If I disable pushstate and start from a deeplinked page like

  www.some.com/folder/index.html#/folder/page.html

all controlgroups break right away.

Today I found this comment in the latest JQM:

// The pagecreate handler for controlgroup is in jquery.mobile.init because of the soft-dependency on the wrapped widgets

which would explain, why this is the only widget that does not get enhanced, wouldn't it?

I'm currently using this function, which I need to run on every page load and AJAX content request:

 var enhanceControlgroups = 
      function( page ){
           page.find( 'div:jqmData(role="controlgroup")').closest('div').trigger('create').controlgroup('refresh').end();
           }

Which fixes controlgroups. Because I get an error "can't call refresh prior to initializiation" if I only run controlgroup('refresh') without trigger('create') I assume the controlgroups are not getting enhanced out of the box.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions