Forum


06:43

20/08/2011

Hi all,
I'm using autocomplete in the "editoptions" property of colModel. I'ts receiving customer id/value pair suggestions to select for an add new record operation. I display the item.value's in the suggestion window. However, i want the item.id of the selected item.value to be added to the "Add Record" window postdata passed to the server on submit.
colNames:['Workorder', 'Customer', 'Technician', 'State', 'Service', 'Service Date', 'Time BLock', 'Payment Type', 'Total', 'Status', 'Notes'],
colModel:[
//use 'id' if you want aftersubmit: function new-id to work.
{name:'id', index:'wo.WOID', width: 70, fixed:true, align:'center', sortable:true, editable:false, edittype:'text', editoptions:{readonly:true,size:10}},
{name:'wo.CUID', index:'cu.LastName', width:120, fixed:true, align:'center', sortable:true, editable:true, edittype:'text',
editoptions:{dataInit:function(el){$(el).autocomplete({ source: 'php/customer-ac-script.php'
, minLength: 1
, change: function(event, ui) { code to add ui.item.id to submit postdata }
})
}},
formoptions:{rowpos: 1, label:'Customer', elmprefix:'* '},
editrules:{required:true}
},
any help would be appeceated.
12:59

Moderators
30/10/2007

Hello,
You can store this id in variable and use beforeSubmit event when the record is added. See the parameters passed to this event - i.e you can extend the posted data with this id.
Another approach is to have this field and fill it when the record is selected.
Some code you may get from our commertial componet here:
http://www.trirand.com/blog/ph.....efault.php
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.
01:21

20/08/2011

I looked at the php demo before you mentioned it. Unfortunetly, there is nothing their that can help since it's completely handled by the php "setAutocomplete" function and i'm using jqgrid on the client side in javascript. I have already invested too much time programming jqgrid under javascript to purchase and reprogram the app in jqgrid php.
However the function of the "setAutocomplete" function does pretty much what i need to do. I need to...
1. (done) select, via autocomplete, server side table column data from the jqgrid edit form.
2. (not sure) update other jqgrid edit form fields with server side data related to the selected data item.
3. (working on it) post data related to the selected edit form data item back to the server to update the jqgrid row i'm editing.
I'm guessing that there is no easy way to do this under javascript jqgrid and that there probably is no "setAutocomplete" function for javascript?
Most Users Ever Online: 715
Currently Online:
45 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