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
Passing Data back from a lookup form
17/07/2008
18:24
Avatar
Reg
Calgary, Canada
Member
Members
Forum Posts: 92
Member Since:
06/06/2008
sp_UserOfflineSmall Offline

This is not a specifically a jqGrid question, but I am hoping someone will know the answer: I have placed an icon beside an input field to call up another form to do a search of the data. The called form allows entering criteria and then presents the records that match.

When the user clicks on one of the records, I want to return the contents of a field and put it into the cell in my jqGrid.

Before I had started to use jqGrid, I had this working using a bit of (I think) very old javascript:

function id8SetField()
{ //v2.0
  var args=id8SetField.arguments;
  for (i=0; i<(args.length-1); i+=2)
  {
 eval(”window.opener.document.forms(0).”+args[i]+”.value='”+args[i+1]+”'”)
  }
  window.close()
}

where args are the name and value of a field on the calling form.

Before I modify this to work with jqGrid, I am wondering if anyone knows of a jQuery plugin that makes this easy. I have looked through the jQuery Plugins pages (but there are so many it would be easy to overlook one) and checked my jQuery in Action book and haven't found anything. I can't believe this hasn't been done before.

Thanks

Reg

18/07/2008
04:34
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Reg,

IMHO you do not need any plugin. You can use some already build in

jqGrid functions with a little code. So look in grid.formedit.js.

There are two usefull functions (that can be used anywhere) -

createModal and viewModal. Look into the parameters and

you will have idea how they can be used. Now the little piece of code.

Let suppose that your form has id myform - then

var fields = $("#myform").serializeArray();
var griddata = {};
jQuery.each(fields, function(i, field){
    griddata[field.name] = field.value;
 });

griddata is already array that can be used anywhere.

If you use inline editing  DO NOT USE setGridRow - this way you will overrite

your edited fields

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

18/07/2008
07:36
Avatar
Reg
Calgary, Canada
Member
Members
Forum Posts: 92
Member Since:
06/06/2008
sp_UserOfflineSmall Offline

Hello Tony,

I'll certainly try this; thanks for the tip.

We don't have any mention of these two methods in the docs. Perhaps this is included in what you mentioned you noticed was missing.

Reg

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
81 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