Forum


18:01

10/11/2009

I need to have a custom edit form so that I can make changes to data I'm not displaying in the grid that exists in the record in mysql. I also need an Add Record Button.
I believe I can accomplish the Add Record using jquery ui like this:
var $dialog = $('<div></div>')
.load('modalForm.php')
.dialog({
autoOpen: false,
title: 'Basic Dialog'
});
$('#opener').click(function() {
$dialog.dialog('open');
});
<button id="opener" class="ui-button ui-state-default ui-corner-all">Create New</button>
But I don't know how to do the same for the edit because I don't know how to pass the selected row to the modal window. for example selecting row 3 and pressing the edit button needs to open a modal with the ajax page "modalForm.php?row=3" my current edit row button calls this:
var gr = jQuery("#editgrid").jqGrid('getGridParam','selrow');
if( gr != null ) jQuery("#editgrid").jqGrid('editGridRow',gr,{height:280,reloadAfterSubmit:false});
else alert("Please Select Row");
});
but I do not know how to modify this to load an external form rather than just the fields that are displayed in the grid. ie "modalForm.php?row=3"
Any suggestions?
18:33

Moderators
30/10/2007

Hello,
Maybe you will need to use the FormToGrid and GridToForm methods in this case.
http://www.trirand.com/jqgridw.....gridtoform
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.
19:47

10/11/2009

I was able to achieve what I needed like this :
$('#opener').click(function() {
var $gr = jQuery("#editgrid").jqGrid('getGridParam','selrow');
if($gr){
var $dialog = $('<div></div>')
.load('modalForm.php?edit=' + $gr)
.dialog({
autoOpen: false,
title: 'Basic Dialog'
});
$dialog.dialog('open');
}
else {
alert('please select a row to edit');}
});
Most Users Ever Online: 715
Currently Online:
51 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