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
Get jqGrid to refresh everytime a jQuery-UI modal dialog is displayed.
01/01/2010
06:58
Avatar
Sean
Guest
Guests

Hello,

I'm trying to use a modal dialog from the jQuery-UI project to display a jqGrid.  When I first coded it I was associating the jqGrid to the #homeLocationSearchGrid element of the #homeLocationSearchDialog in the ready function.  It displayed correctly, but the jqGrid was getting populated when the page first loaded which I didn't want.  I wanted it to load the jqGrid whenever the button was pushed that pops up the dialog box.  The jqGrid didn't seem to have a way to tell it not to populate when it is initially instantiated.  Is there a way to do that?  Since I couldn't find out how to do that, I modified my code (see below) to attach the jqGrid to the #homeLocationSearchGrid element every time the button is pushed.  However, I don't see the XHR request going through after the first display of the dialog box.  So then I wanted to disassociate the jqGrid everytime the dialog was closed, but I didn't really know how to do that.  I puta call to GridDestroy in the "close" method of the dialog box.  However, after I close the dialog the first time, all subsequent displays of it don't have the jqGrid inside.  Can anyone help me on this?  Thanks!

Sean

    $(document).ready(function() {
        // Create date picker for effective date input field.
        $('#effectiveDate').datepicker();

        // Setup the home location search popup window.
        var searchDialog = $('<div id="homeLocationSearchDialog"></div>')
           .html('<div><table id="homeLocationSearchGrid"></table></div><div id="homeLocationSearchPager"></div>')
           .dialog({
               altRows: true,
               autoOpen: false,
               close: function(event, ui) {

$('#homeLocationSearchGrid').jqGrid('GridDestroy');

                },
               modal: true,
               title: 'Find Home Location',
               width: 1100
           });

        // Attach the home location popup to the home location search button.
        $('#homeLocationSearchButton').click(function() {

               $('#homeLocationSearchGrid').jqGrid({
                    url: '<c:out value="${homeLocationSeasrchUrl}" />',
                    datatype: 'xml',
                    mtype: 'GET',
                    colNames: ['Location ID', 'Location Name', 'Address 1', 'Address 2', 'City', 'State', 'Zip Code'],
                    colModel: [
                               {name: 'locationId', index: 'locationId'},
                               {name: 'locationName', index: 'locationName'},
                               {name: 'address1', index: 'address1'},
                               {name: 'address2', index: 'address2'},
                               {name: 'city', index: 'city'},
                               {name: 'state', index: 'state'},
                               {name: 'zipCode', index: 'zipCode'}
                             ],
                    rowNum: 10,
                    rowList: [10, 25, 50],
                    pager: '#homeLocationSearchPager',
                    sortname: 'locationId',
                    viewrecords: true
              });
           
            searchDialog.dialog('open');
        });
    });

01/01/2010
07:57
Avatar
smanning
Member
Members
Forum Posts: 5
Member Since:
01/01/2010
sp_UserOfflineSmall Offline

Seems to work if I use "GridUnload":

$('#homeLocationSearchGrid').jqGrid('GridUnload');

Not sure if this is the correct way to do it works.

03/01/2010
19:11
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Yes it is the correct way.

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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