Forum
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
04:34
Moderators
30/10/2007
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.
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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66