Forum


03:41

03/10/2008

Hello!
First of all, thanks to the developpers of jqGrid. This pluggin is just incredibable.
So I'm trying to integrate autocomplete pluggin in a subgrid. For that I've followed the documentation (with datepicker integration) and a post in this forum, explaining how to integrate autocomplete and a grid.
I've been able to make it work in this context but I can't make it work in a subgrid.
I'm using Firebug in order to debur and see any query sent, but nothing happens. It's just as if the autocomplete event is not launched when editing the field.
Here is the code I'm using :
jQuery(”#list”).jqGrid({
#Main grid definition
url:'devis.grid.php?id_devis='+<?php echo $_GET['id'];?>,
datatype: 'xml',
…,
subGrid: true,
subGridRowExpanded: function(subgrid_id, row_id) {
#Subgrif definition
var subgrid_table_id, pager_id;
subgrid_table_id = subgrid_id+”_t”;
pager_id = “p_”+subgrid_table_id;
$(”#”+subgrid_id).html(”<table id='”+subgrid_table_id+”' class='scroll'></table><div id='”+pager_id+”' class='scroll'></div>”);
jQuery(”#”+subgrid_table_id).jqGrid({
…,
ondblClickRow:function(id){
if(id && id!==lastSel){
jQuery(”#”+subgrid_table_id).restoreRow(lastSel);
jQuery(”#”+subgrid_table_id).editRow(
id,
true,
autocomplete_field(id,”description”,subgrid_table_id),
'',
'devis.subgrid.php',
{'id':id,'id_niv1':row_id,'oper':'edit','id_devis':'<?php echo $_GET['id'];?>'},
MAJ_montant_ht()
);
lastSel=id;
}
}
…
function autocomplete_field(id,field,table){ jQuery(”#”+id+”_”+field,”#”+table).autocomplete(”include/ac.clients.php”, {
width: 300,
multiple: false,
mustMatch: true,
matchContains: true,
formatItem: function formatItem(row) {
return row[0];
},
formatResult: function formatResult(row) {
return row[0].replace(/(<.+?>)/gi, '');
}
});
};
I hope some one could help
Thanks
Slin
12:18

Moderators
30/10/2007

Hello,
try this
ondblClickRow:function(id){
if(id && id!==lastSel){
jQuery("#"+id,”#”+subgrid_table_id).restoreRow(lastSel);
jQuery("#"+id,”#”+subgrid_table_id).editRow(
id,
true,
....
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.
12:40

Moderators
30/10/2007

Hello,
I'm sorry for the bad post - this tottaly is wrong.
Also try in function autocomplete_field function just to put alert and see
if it lunches. If this is the case, then check the input parameters if they are
correct.
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.
05:51

03/10/2008

Hello Tony!
No problem 😉
I've done some tests with Firebug and alerts. It seems that my function "autocomplete_field(id,field,table)" is well called but that the jQuery call is not.
In other words, that mean that next constructionis not good.
jQuery("#"+id+"_"+field,"#"+table).autocomplete("include/ac.clients.php", { ...
I think that it comes from "#"+id+"_"+field,"#"+table
but I can't see why this is not good. Perhaps do I not respect something.
I'll continue my investigation 🙂
Thanks
SliN
Most Users Ever Online: 715
Currently Online:
95 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