Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
A little help Please - Problem with code segment.
05/11/2011
06:43
Avatar
nelsonm
Michigan, USA
Member
Members
Forum Posts: 106
Member Since:
20/08/2011
sp_UserOfflineSmall Offline

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.

    $('#tab3-grid').jqGrid({
        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.

07/11/2011
12:59
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

09/11/2011
01:21
Avatar
nelsonm
Michigan, USA
Member
Members
Forum Posts: 106
Member Since:
20/08/2011
sp_UserOfflineSmall Offline

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?

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information