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

feature request: trigger('eventcreate') to set event bindings to a widget without enhancing the markup #4935

Closed
frequent opened this issue Sep 4, 2012 · 6 comments

Comments

@frequent
Copy link
Contributor

frequent commented Sep 4, 2012

I have started to do I site where I'm creating enhanced JQM markup server-side to prevent the page from stalling when enhancing elements from a page or content pull.

This works except for the element bindings I'm missing on widgets like controlgroups.

So why don't have a trigger('eventcreate)` method in widgets that have allows to initialize a widget without enhancing the markup = only set element bindings?

@frequent
Copy link
Contributor Author

frequent commented Sep 4, 2012

I'm trying this with a few widgets now. Not that complicated. I'm mostly setting:

  1. extra option:
  eventsOnly: null
  1. check for data-eventsOnly="true" on the element
  if ( $el.jqmData("eventsOnly") == true ){
        o.eventsOnly = true;
  }
  1. Wrap all content enhancing code into this
  if ( o.eventsOnly != true ){
     // enhance widgets
  }
  1. this will set up the widget event bindings and ensure the widget will work properly, while all the heavy-duty code-enhancement is done elsewhere.

@toddparker
Copy link
Contributor

@frequent - the ability to pre-decorate the markup and just bind events is something we really want to tackle. Would you be interested in working on this and coordinating with @johnbender and @scottjehl as you go? I'd like to tackle this for 1.3 or 1.4 at the latest.

@frequent
Copy link
Contributor Author

frequent commented Sep 4, 2012

@toddparker, @johnbender, @scottjehl - ok. Should be enough time for me to try and get Github set up properly... ;-).

@frequent
Copy link
Contributor Author

frequent commented Oct 4, 2012

@toddparker, @johnbender, @scottjehl

Ok. I have started to play around with this. I'm using:

   data-create="false"

as attribute to be put on a widget to only add JQM event bindings. Easy example (no events...) would be a controlgroup, where I'm just changing (still using JQM 1.2a):

if ( $.fn.controlgroup ) {
    $( document ).bind( "pagecreate create", function( e ) {
        $( ":jqmData(role='controlgroup')", e.target )
            // XXX filter eventsOnly
            .not( ":jqmData(create='false')" )
            .jqmEnhanceable()
            .controlgroup({ excludeInvisible: false });
            });
    }

in initializePage

I have also done button, collapsible and collapsibleSet widgets, which works quite nice (only need to shuffle code around so far).

Where should I put stuff I'm doing, so someone can take a look if interested? Create a branch for this?

@jaspermdegroot
Copy link
Contributor

As discussed during today's meeting we are going to provide a "do not enhance" option, not an event. We'll make a new ticket for this.

@frequent
Copy link
Contributor Author

frequent commented Apr 4, 2013

Ok. I'm also doing this via option, not event... :-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants