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
Custom Edit Form
28/12/2009
18:01
Avatar
Dmoney
Member
Members
Forum Posts: 8
Member Since:
10/11/2009
sp_UserOfflineSmall Offline

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:

$("#bedata").click(function(){
    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?

28/12/2009
18:33
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

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.

28/12/2009
19:47
Avatar
Dmoney
Member
Members
Forum Posts: 8
Member Since:
10/11/2009
sp_UserOfflineSmall Offline

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');}
    });

17/05/2010
07:31
Avatar
krakerns
New Member
Members
Forum Posts: 1
Member Since:
17/05/2010
sp_UserOfflineSmall Offline

Noob Question: How can i close the loaded modal window? if it is loaded from other page.

Forum Timezone: Europe/Sofia

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

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

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information