Autocomplete - only first letter of each item in dropdown list
Hi all
First of all, great thank for this fine plugin !
I tried to use it in my app and I only have the first letter of each item in the dropdown list. So it is very difficult to select the good option !
I have search any information in these forums about this trouble, but no success.
Here is my js code :
- $(this).autocomplete(
url,
{
delay:0,
minChars:0,
width:135,
scroll:true,
scrollHeight:150,
cacheLength:5,
dataType:'json',
parse:function(data) {
return $.map(data, function(item) {
return {
data: item,
value: item,
result: item
}
});
},
autoFill:true
}
);
and my php code which generate json datas, from Jelix framework:
- $rep = $this->getResponse('json');
$sql="SELECT
distinct(code)
FROM mark
WHERE code like '".$_REQUEST['q']."%'";
- $cnx=jDb::getConnection();
$rs=$cnx->query($sql);
$responce=array();
while($row = $rs->fetch()){
$responce[]=$row->code;
}
- $rep->data=$responce;
return $rep;
perhaps this code is wrong and json format not good ?
so, the first item of dropdown list is fine in the input box, but all items with only one letter in dropdown list.
I hope any body can spend a few time and help me a little to understand that is wrong, as I could terminate my app.
Many thanks in advance
Regards
JiheL