Select2 component creates problem of sizing with jmobile.

This commit is contained in:
Laurent Destailleur 2015-01-31 19:25:26 +01:00
parent 21f72c7594
commit 9188be57ce
5 changed files with 24 additions and 17 deletions

View File

@ -832,8 +832,9 @@ class Form
if ($conf->use_javascript_ajax && ! $forcecombo) if ($conf->use_javascript_ajax && ! $forcecombo)
{ {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT); $comboenhancement =ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
$nodatarole=' data-role="none"'; $out.= $comboenhancement;
$nodatarole=($comboenhancement?' data-role="none"':'');
} }
// Construct $out and $outarray // Construct $out and $outarray
@ -1037,8 +1038,9 @@ class Form
if ($conf->use_javascript_ajax && ! $forcecombo && ! $options_only) if ($conf->use_javascript_ajax && ! $forcecombo && ! $options_only)
{ {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox($htmlname, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT); $comboenhancement = ajax_combobox($htmlname, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT);
$nodatarole=' data-role="none"'; $out.= $comboenhancement;
$nodatarole=($comboenhancement?' data-role="none"':'');
} }
if ($htmlname != 'none' || $options_only) $out.= '<select class="flat'.($moreclass?' '.$moreclass:'').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>'; if ($htmlname != 'none' || $options_only) $out.= '<select class="flat'.($moreclass?' '.$moreclass:'').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>';
@ -1230,8 +1232,9 @@ class Form
/*if ($conf->use_javascript_ajax) /*if ($conf->use_javascript_ajax)
{ {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox($htmlname); $comboenhancement = ajax_combobox($htmlname);
$nodatarole=' data-role="none"'; $out.= $comboenhancement;
$nodatarole=($comboenhancement?' data-role="none"':'');
}*/ }*/
$out.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled="disabled"':'').$nodatarole.'>'; $out.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled="disabled"':'').$nodatarole.'>';
@ -4288,7 +4291,7 @@ class Form
// Try also magic suggest // Try also magic suggest
// Add data-role="none" to diable jmobile decoration // Add data-role="none" to disable jmobile decoration
$out = '<select data-role="none" id="'.$htmlname.'" class="multiselect" multiple="multiple" name="'.$htmlname.'[]"'.$option.($width?' style="width: '.$width.'px"':'').'>'."\n"; $out = '<select data-role="none" id="'.$htmlname.'" class="multiselect" multiple="multiple" name="'.$htmlname.'[]"'.$option.($width?' style="width: '.$width.'px"':'').'>'."\n";
if (is_array($array) && ! empty($array)) if (is_array($array) && ! empty($array))
{ {
@ -4628,8 +4631,9 @@ class Form
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox($htmlname); $comboenhancement = ajax_combobox($htmlname);
$nodatarole=' data-role="none"'; $out.= $comboenhancement;
$nodatarole=($comboenhancement?' data-role="none"':'');
} }
$out.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled="disabled"':'').$nodatarole.'>'; $out.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled="disabled"':'').$nodatarole.'>';

View File

@ -324,8 +324,9 @@ class FormOther
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$moreforfilter.= ajax_combobox('select_categ_'.$htmlname); $comboenhancement = ajax_combobox('select_categ_'.$htmlname);
$nodatarole=' data-role="none"'; $moreforfilter.=$comboenhancement;
$nodatarole=($comboenhancement?' data-role="none"':'');
} }
// Print a select with each of them // Print a select with each of them
@ -373,8 +374,9 @@ class FormOther
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox($htmlname); $comboenhancement = ajax_combobox($htmlname);
$nodatarole=' data-role="none"'; $out.=$comboenhancement;
$nodatarole=($comboenhancement?' data-role="none"':'');
} }
// Select each sales and print them in a select input // Select each sales and print them in a select input
$out.='<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>'; $out.='<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>';

View File

@ -91,8 +91,9 @@ class FormProjets
if (! empty($conf->use_javascript_ajax)) if (! empty($conf->use_javascript_ajax))
{ {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox($htmlname, '', 0, $forcefocus); $comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
$nodatarole=' data-role="none"'; $out.=$comboenhancement;
$nodatarole=($comboenhancement?' data-role="none"':'');
} }
if (empty($option_only)) { if (empty($option_only)) {

View File

@ -114,7 +114,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '<td class="nowrap">'; print '<td class="nowrap">';
print $langs->trans("Project").' &nbsp; '; print $langs->trans("Project").' &nbsp; ';
print '</td><td class="nowrap maxwidthonsmartphone">'; print '</td><td class="nowrap maxwidthonsmartphone">';
$formproject->select_projects($socid?$socid:-1, $pid, 'projectid'); $formproject->select_projects($socid?$socid:-1, $pid, 'projectid', 0);
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -322,7 +322,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $
global $conf; global $conf;
//if (! empty($conf->browser->phone)) return ''; // combobox disabled for smartphones (does not works) //if (! empty($conf->browser->phone)) return ''; // combobox disabled for smartphones (does not works)
//if (! empty($conf->dol_use_jmobile)) return ''; // select2 works with jmobile if (! empty($conf->dol_use_jmobile)) return ''; // select2 works with jmobile but it breaks the autosize feature of jmobile.
if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return ''; if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return '';
if (empty($conf->use_javascript_ajax)) return ''; if (empty($conf->use_javascript_ajax)) return '';