I am using SumoSelect v3.0.3 on my select tag (It makes multiselect options), but I have a problem with handling events on Android devices. On close select tag alert()
does not appear.
Just need ANY call my function or trigger on closing sumo select. On Android and desktop...
- proper solution can be in older 3.0.2 version...
There is a working fiddle: LINK - open and close select input after that on a desktop you can see an alert window with 'Drop down closed!' text but on an android device you won't...
// .class pointing to <select> tag
$('.class').SumoSelect({placeholder: 'Select choice'});
$('select').on('sumo:closed', function(sumo) {
alert("Drop down closed!");
});
On a desktop (Firefox/Chrome) it works... Any suggestions?
I am pretty weak in javascript/jquery but in previsious version (3.0.2) i had my own trigger $(document).trigger('sumoCloseSelect');
direct in sumoselect.js plugin like this (last line):
showOpts: function () {
var O = this;
if (O.E.attr('disabled')) return; // if select is disabled then retrun
O.is_opened = true;
O.select.addClass('open');
if(O.ftxt)O.ftxt.focus();
else O.select.focus();
// hide options on click outside.
$(document).on('click.sumo', function (e) {
if (!O.select.is(e.target) // if the target of the click isn't the container...
&& O.select.has(e.target).length === 0){ // ... nor a descendant of the container
if(!O.is_opened)return;
O.hideOpts();
$(document).trigger('sumoCloseSelect');
(yes very dirty) and after that in my main.js file:
$(document).on('sumoCloseSelect', function(e) {
alert('Drop down closed!');
...
But this solution isn't working on android too...
EDIT:
I tried to add the following to sumoselect js file jQuery.myFunction();
(like in prev ex.) and in own js define it
jQuery.myFunction= function(){
alert('yep!');
};
and again for desktops, it works but not for Android...
EDIT2:
with init setting forceCustomRendering: true
all triggers work... but I want this setting on false
(default)