Forum


10:30

11/11/2011

Hi,
I have a problem with the integration of jquery-ui autocomplete and jqgrid in search fields.
My code:
lastSel = 0;
jQuery("#list2").jqGrid({
url:'./accoglienza/ajax-dati',
datatype: "json",
colNames:['id', 'Ospite', 'Cognome', 'Nome', 'Località', 'Istituto', 'Data ammissione', 'Att. diurna', 'Punteggio', 'Retta giornaliera', 'Data dimissione', 'Azioni'],
colModel:[
{name:'LAT_ID',index:'LAT_ID', hidden: true, editable: true, editrules: { edithidden: false }, hidedlg: true},
{name:'OSP_ID',index:'OSP_ID', hidden: true, editable: true, editrules: { edithidden: false }, hidedlg: true},
{name:'PER_COGNOME',index:'PER_COGNOME', width:150, searchoptions: {sopt:['eq','ne','bw']}},
{name:'PER_NOME',index:'PER_NOME', width:150, searchoptions: {sopt:['eq','ne','bw']}},
{name:'LOC_ID',index:'LOC_ID', width:150, searchoptions: {sopt:['eq','ne'], dataInit:function(elem){
$(elem).autocomplete({
source: "/Invalidi/public/localita/ajax-dati",
minLength: 2,
select: function(event, ui) {
//${elem).val(ui.item.id); //doesn't work!
}
});
}}},
{name:'IST_NOME',index:'IST_NOME', width:150, searchoptions: {sopt:['eq','ne','bw']}},
{name:'ACC_DATA_AMMISSIONE',index:'ACC_DATA_AMMISSIONE', width:100, searchoptions: {sopt:['eq','ne','lt','le','gt','ge']}},
{name:'ACC_ATTIVITA_DIURNA',index:'ACC_ATTIVITA_DIURNA', width:170, searchoptions: {sopt:['eq']}, stype: 'select', searchoptions: { value: "<?php echo $this->attivitaDiurna;?>" } },
{name:'ACC_PUNTEGGIO',index:'ACC_PUNTEGGIO', align: 'right', width:50, searchoptions: {sopt:['eq','ne','lt','le','gt','ge']}},
{name:'ACC_RETTA_GIORNALIERS',index:'ACC_RETTA_GIORNALIERS', align: 'right', width:80, searchoptions: {sopt:['eq','ne','lt','le','gt','ge']}},
{name:'ACC_DATA_DIMISSIONE',index:'ACC_DATA_DIMISSIONE', width:150, searchoptions: {sopt:['eq','ne','lt','le','gt','ge']}},
// {name:'ANNO',index:'ANNO', width:50, align:'center', searchoptions: {sopt:['eq']}},
{name:'AZIONI',index:'AZIONI', width:50, align:'center', search: false}
],
rowNum:20,
pager: '#pager2',
sortname: 'PER_COGNOME',
viewrecords: true,
sortorder: "asc",
caption:"Ospiti",
width:950,
height:250,
hidegrid: false, beforeSearch:function(){alert('ciao');}
});
jQuery("#list2").jqGrid('navGrid','#pager2',{edit:false,add:false,del:false},{},{},{},{multipleSearch:true})
/*.navButtonAdd('#pager2',{
caption:"",
buttonicon:"ui-icon ui-icon-pencil",
onClickButton: function(){
var gr = jQuery("#list2").jqGrid('getGridParam','selrow');
var ospId = jQuery("#list2").getCell(gr,'OSP_ID');
if( gr != null )
window.location.href = 'accoglienza/modifica?LAT_ID=' + gr + '&OSP_ID=' + ospId;
else
alert("Per favore, seleziona un ospite");
},
position:"last",
title:"Modifica dati dell'ospite"
})*/
.navButtonAdd('#pager2',{
caption:"",
buttonicon:"ui-icon ui-icon-plus",
onClickButton: function(){
window.location.href = 'lista-attesa/modifica';
},
position:"last",
title:"Inserisci un ospite"
});
</script>
Autocomplete works perfectly, by typing it make a request and the result is displayed. When I select a result, the search field is filled with the value. The problem is: when I press the search button, the search request contains what I have entered with the keyboard, and not the value of the autocomplete option selected.
What's wrong?
Sorry for my english
Have a nice day
10:50

20/08/2011

look at my post... http://www.trirand.com/blog/?p.....id-posted/
18:14

20/08/2011

however, i have made a few corrections to my post reference – as it was incorrect in describing how autocomplete works.
Look at my last post in that thread now: http://www.trirand.com/blog/?p.....id-posted/
and you will probably answer your own question.
Most Users Ever Online: 715
Currently Online:
52 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66