Skip to content

Instantly share code, notes, and snippets.

@dbarrionuevo
Last active August 29, 2015 14:14
Show Gist options
  • Save dbarrionuevo/d498c738eb3149bf1f9a to your computer and use it in GitHub Desktop.
Save dbarrionuevo/d498c738eb3149bf1f9a to your computer and use it in GitHub Desktop.
<!-- Este tiene el bh que carga TransacSearchMembers -->
<a class="ura peluda">
<div class="box-right">
<form data-behavior="transac_search_add" id="407" action="..." method="post">
...
...
</form>
</div>
</a>
// Select a member for a transaction in the members search
YouConnect.Behaviors.TransacSearchAdd = Essential.Behavior.extend({
init: function() {
// Este se muestra una vez por item, todo joya
console.log('init ADD');
$(this.el).on("submit", function(e) {
// Jamas llega acá
e.preventDefault();
})
}
});
YouConnect.Behaviors.TransacSearchMembers = Essential.Behavior.extend({
init: function() {
$(this.el).autocomplete({
// Un millon de pijas de configuración del autocomplete
// ...
// ...
}).data( "ui-autocomplete" )._renderItem = function( ul, item ) {
// La estructura de cada item está abajo
// Load transac_search_add
Essential.loadBehaviors({
context: $(item.outerHTML)[0],
application: window.YouConnect.Behaviors
});
return $( "<li class='result-autocomplete'>" ).append(item.outerHTML).appendTo( ul );
};
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment