|
|
|
|
|
|
|
|
if ($select.data('width')) { |
|
|
if ($select.data('width')) { |
|
|
options.width = 'auto' |
|
|
options.width = 'auto' |
|
|
} |
|
|
} |
|
|
if ($select.find('option[value=""]')) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @TODO : génère une erreur |
|
|
|
|
|
/*if ($select.find('option[value=""]')) { |
|
|
options.placeholder = $select.find('option[value=""]').html() |
|
|
options.placeholder = $select.find('option[value=""]').html() |
|
|
} |
|
|
|
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
options.placeholder = ""; |
|
|
|
|
|
|
|
|
var myselect = $select.select2(options); |
|
|
var myselect = $select.select2(options); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var event = new Event('change'); |
|
|
var event = new Event('change'); |
|
|
e.target.dispatchEvent(event); |
|
|
e.target.dispatchEvent(event); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
myselect.on('select2:unselect', function (e) { |
|
|
myselect.on('select2:unselect', function (e) { |
|
|
var event = new Event('change'); |
|
|
var event = new Event('change'); |
|
|
e.target.dispatchEvent(event); |
|
|
e.target.dispatchEvent(event); |
|
|
}); |
|
|
}); |
|
|
SovTools.log(myselect); |
|
|
|
|
|
|
|
|
|
|
|
myselect.off('select2:open') |
|
|
myselect.off('select2:open') |
|
|
|
|
|
|