Enhance select2 component to allow onrightofpage
This commit is contained in:
parent
0e276fba5e
commit
761ca8ca43
@ -480,8 +480,11 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$(\''.(preg_match('/^\./', $htmlname) ? $htmlname : '#'.$htmlname).'\').'.$tmpplugin.'({
|
||||
dir: \'ltr\',
|
||||
width: \''.dol_escape_js($widthTypeOfAutocomplete).'\', /* off or resolve */
|
||||
dir: \'ltr\',';
|
||||
if (preg_match('/onrightofpage/', $morecss)) { // when $morecss contains 'onrightofpage', the select2 component must also be inside a parent with class="parentonrightofpage"
|
||||
$msg .= ' dropdownAutoWidth: true, dropdownParent: $(\'#'.$htmlname.'\').parent(), '."\n";
|
||||
}
|
||||
$msg .= ' width: \''.dol_escape_js($widthTypeOfAutocomplete).'\', /* off or resolve */
|
||||
minimumInputLength: '.((int) $minLengthToAutocomplete).',
|
||||
language: select2arrayoflanguage,
|
||||
matcher: function (params, data) {
|
||||
@ -499,6 +502,7 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
|
||||
theme: \'default'.$moreselect2theme.'\', /* to add css on generated html components */
|
||||
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
|
||||
selectionCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
|
||||
dropdownCssClass: \'ui-dialog\',
|
||||
templateResult: function (data, container) { /* Format visible output into combo list */
|
||||
/* Code to add class of origin OPTION propagated to the new select2 <li> tag */
|
||||
if (data.element) { $(container).addClass($(data.element).attr("class")); }
|
||||
@ -515,8 +519,7 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
|
||||
},
|
||||
escapeMarkup: function(markup) {
|
||||
return markup;
|
||||
},
|
||||
dropdownCssClass: \'ui-dialog\'
|
||||
}
|
||||
})';
|
||||
if ($forcefocus) {
|
||||
$msg .= '.select2(\'focus\')';
|
||||
|
||||
@ -1142,12 +1142,12 @@ if (!empty($arrayfields['p.tms']['checked'])) {
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['p.tosell']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<td class="liste_titre center parentonrightofpage">';
|
||||
print $form->selectarray('search_tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'), '1'=>$langs->trans('ProductStatusOnSellShort')), $search_tosell, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage');
|
||||
print '</td >';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['p.tobuy']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<td class="liste_titre center parentonrightofpage">';
|
||||
print $form->selectarray('search_tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'), '1'=>$langs->trans('ProductStatusOnBuyShort')), $search_tobuy, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage');
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -1715,6 +1715,11 @@ select.widthcentpercentminusxx, span.widthcentpercentminusxx:not(.select2-select
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.parentonrightofpage {
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
|
||||
/* Force values for small screen 767 */
|
||||
@media only screen and (max-width: 767px)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user