在我的smarty模板项目中,我们使用了具有多个值选择的下拉列表。为此,我们使用了以下代码:
Html代码:
<p>Groups Allowed:
<a href="#" data-type="select2" id="groups_allowed" data-name="groups_allowed" data-pk="7" data-title="Groups Allowed" data-url="/leads/update_agent_report_information/{$agent->report_per_id}" class="editable editable-click" style="width:400px;">
{if true eq isset($groups_allowed)}{$groups_allowed}{/if}
</a>
</p>
JS代码:
$('#groups_allowed').editable({
type: 'select2',
pk : 7,
url: '/leads/update_agent_report_information/individual_lead_id',
title: 'Groups Allowed',
name : 'groups_allowed',
source:group_array,
select2: {
multiple: true,
sortResults: function(group_array, container, query) {
return group_array.sort(function(a, b) {
a = a.text.toLowerCase();
b = b.text.toLowerCase();
if(a > b) {
return 1;
} else if (a < b) {
return -1;
}else{
return 0;
}
});
}
},
inputclass: 'mySelect',
emptytext : 'Add Group',
value:{/literal}{if true eq isset($agent->groups_allowed_for_reports)}'{$agent->groups_allowed_for_reports}' {else} '' {/if}{literal}
});
它在FF中工作正常,但是当列表增加时在chrome中,它会在点击时禁用下拉列表。