Forum


23:41

04/11/2008

I successfully configured autocomplete (inline edit).
My autocomplete returns UserName and UserID.
I want Username to be visible and UserID returned to the server.
1. If UserID is hidden then I can't seem to change it.
Is there a way that autocomplete results will bind like when using editoptions:{value:"FE:FedEx;IN:InTime;TN:TNT;AR:ARAMEX"}?
Perhaps someone has done this in a clean way and can reccommend a plan of attack.
Thanks!
04:09

Moderators
30/10/2007

Hello Barry,
One possible solution is to use the events available in autocomplete -
i.e. if the value is selected - get the id and set it to the grid using
setRowData method. I reccomend you to use aftersavefunc for this
purpose.
Best Regads
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
11:03

04/11/2008

I guess I am doing something wrong. The aftersavefunction is not being called.
…editRow(”+cl+”,true,onEditFunc1,null,null,null,null,onAfterSave1);>”;
jQuery(”#”+id+”_EntityName”,”#grid1″).
autocomplete(”/ajax_server/autocomplete/group_lookup.php”, {
width: 100,
selectFirst: false
});
}
function onAfterSave1(id){
$(”#”+id+”_EntityName”).result(function(event, data, formatted) {
if (data)
//alert(formatted);
//alert(data[0] + ” ” + data[1]);
//jQuery(”#”+id+”_EntityID”,”#grid1″).val(data[1]);
jQuery(”#grid1″).setRowData(id,{'EntityID':data[1]});
});
}
Is this what you had in mind?
Barry
13:13

Moderators
30/10/2007

Hello Barry,
The result function of autocomplete is better to be in onEditFunc.
Also - the trick.
Define one global variable in the scope, set this variable in result
function and the in aftersave function change the needed grid cell.
If you change only one value I suggest you to use setCell method
(see docs)
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
06:33

Moderators
30/10/2007

var myvalset;
….
function onEditFunc1(id){
jQuery(”#”+id+”_EntityName”,”#grid1″).
autocomplete(”/ajax_server/autocomplete/group_lookup.php”, {
width: 100,
selectFirst: false
});
$(”#”+id+”_EntityName”).result(function(event, data, formatted) {
if (data) {
myvalset = data[1];
} else { myvalset = null;}
});
}
function onAfterSave1(id){
if (myvalset) {
jQuery(”#grid1″).setRowData(id,{'EntityID':myvalset});
}
}
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
65 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