Permalink
Browse files

Filterable backcompat: Trigger listviewbeforefilter

Fixes #6679
  • Loading branch information...
gabrielschulhof committed Oct 29, 2013
1 parent c2e707c commit e110656733473daf459fedd89d53763f840dcda0
Showing with 7 additions and 0 deletions.
  1. +7 −0 js/widgets/filterable.backcompat.js
@@ -69,6 +69,13 @@ $.widget( "mobile.filterable", $.mobile.filterable, {
if ( !this._widget && widget ) {
this._widget = widget;
this._widget._setOptions = replaceSetOptions( this, this._widget._setOptions );
if ( widget.widgetFullName === "mobile-listview" ) {
this.element.on( "filterablebeforefilter", $.proxy( function( event ) {

This comment has been minimized.

Show comment
Hide comment
@arschmitz

arschmitz Dec 23, 2013

Member

several questions here.

  • Why are we listening for an even emitted by the same widget?
  • Why arnt you using this._on doing it with .on makes it so you are delegating this to the document and ._on avoids the need for the proxy
  • Why are we checking event.target this this an attempt to support nested filterable? if so do have tests to show this works at all or have we ever talked about if this is supported? also not listing for the event and calling directly would avoid the need for this
@arschmitz

arschmitz Dec 23, 2013

Member

several questions here.

  • Why are we listening for an even emitted by the same widget?
  • Why arnt you using this._on doing it with .on makes it so you are delegating this to the document and ._on avoids the need for the proxy
  • Why are we checking event.target this this an attempt to support nested filterable? if so do have tests to show this works at all or have we ever talked about if this is supported? also not listing for the event and calling directly would avoid the need for this
if ( event.target === this.element[ 0 ] ) {
this.element.trigger( "listviewbeforefilter" );

This comment has been minimized.

Show comment
Hide comment
@arschmitz

arschmitz Dec 23, 2013

Member

triggering an event like this in another widgets name seems bad.

@arschmitz

arschmitz Dec 23, 2013

Member

triggering an event like this in another widgets name seems bad.

}
}, this ));
}
}
if ( !!this._widget ) {

0 comments on commit e110656

Please sign in to comment.