Hi
I'm trying to integrate the JQueryUI autocomplete plugin in my EasyUI application (to create a street/postalcode/city widget), but I get a error on my EasyUI accordion menu :
jquery.min.js:2 Uncaught Error: no such method 'select' for accordion widget instance
I'm using EasyUI 1.5.5 and JQueryUI 1.12.1
my page looks like this :
first, call EasyUI lib's :
<link rel="stylesheet" id="stylesheetJeasyui" type="text/css" href="/InSquare/resources/css/default/easyui.css">
<script type="text/javascript" src="/InSquare/resources/js/jquery.min.js"></script>
<script type="text/javascript" src="/InSquare/resources/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/InSquare/resources/js/locale/easyui-lang-fr.js"></script>
then create the menu :
<body>
...
<div class="easyui-accordion" id="acc" data-options="fit:false,border:false,animate:false">
<div title="First" style="padding:10px;">
Content 1
</div>
<div title="Second" style="padding:10px;">
Content 2
</div>
</div>
...
and select the second menu item :
<script>
$(function(){
$('#acc').accordion('select','Second');
});
</script>
and finally, create the autocomplete textbox with JUI : I follow others recomandations on the forum to include the script inside body, but the error above is always raised :
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>
<input name="cp" id="cp" type="text" placeholder="CP">
<script>
$(function(){
$("#cp").autocomplete({
source: function (request, response) {
$.ajax({
url: "https://api-adresse.data.gouv.fr/search/?postcode="+$("input[name='cp']").val(),
data: { q: request.term },
dataType: "json",
success: function (data) {
var postcodes = [];
response($.map(data.features, function (item) {
// Ici on est obligé d'ajouter les CP dans un array pour ne pas avoir plusieurs fois le même
if ($.inArray(item.properties.postcode, postcodes) == -1) {
postcodes.push(item.properties.postcode);
return { label: item.properties.postcode + " - " + item.properties.city,
city: item.properties.city,
value: item.properties.postcode
};
}
}));
}
});
}
});
});
</script>
Any help greatly appreciated !!