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_Related Related Topics sp_TopicIcon
Custom drop-down edittype not working
17/06/2010
00:58
Avatar
Gil
Member
Members
Forum Posts: 8
Member Since:
22/04/2010
sp_UserOfflineSmall Offline

I have a custom edit dialog control that is supposed to work as follows:

  • The custom  "edittype" contains a select control (drop-down list) and a "Find" button.
  • The button "onclick" event launches a "search" dialog that contains a text box and "submit" and "cancel" buttons.  When the submit button is clicked, an AJAX server call is made, and a list (for the drop-down) is created – based on the criteria in the text box – and returned.

To prototype this, I created a jQuery dialog with a select control and button, and I called my dialog from it. It worked as specified.

When I incorporate it into the editGridRow dialog, it fails as follows: the "search" dialog opens for a second and then both the search and edit dialog close and my grid refreshes.

It appears that I have not properly implemented the "handshake" with jqGrid. (Although, I don't know what is wrong.) I'd appreciate any help and suggestions. The code follows.

The jqGrid column model entry for the custom form element:

  { name:'ItemId', index:'ItemId', hidden:true, width:40, resizable:false, fixed:true,
    align:'left', editable:true, editrules:{edithidden:true}, edittype:'custom',
    editoptions:{ custom_element:SearchSelectElem, custom_value:SearchSelectVal } },

The HTML to launch the edit dialog:

  <a href="#" class="jqg-grid-edit"
    onclick="jQuery('#jqg_table')
               .jqGrid( 'editGridRow', 1,
                        { width:400, savekey:[true,13], url:'/Account/UserEdit',
                          modal:true, reloadAfterSubmit:true, closeAfterEdit:true,
                          onclickSubmit:CreatePostList, afterSubmit:CheckSubmitStatus } );">
    <span class="ui-icon ui-icon-pencil"></span>
  </a>

The custom element code (SearchSelectElem) builds the following control:

  <div>
    <select id="ItemId-sel" style="width: 200px;" size="1″>
      <option value="1″>Current Item</option>
    </select>
    <button id="ItemId-btn" onclick="ShowDlog();">Find</button>
  </div>
The js code triggered by the button's onclick event:

  function ShowDlog()
  {
    // create the dialog content and attache it to the custom element field
    //   (I got the same resultes when I appended it to my "main content" div.)
    var dlog = '<div id="ItemId-dlog" title="Search Clients" style="display:none">'
             +   '<input type="text" id="ItemId-dlog-inp" name="ItemId-dlog-inp">'
             + '</div>';
    jQuery('#ItemId').append( dlog );

    // create the dialog
    jQuery('#ItemId-dlog')
        .dialog({
          autoOpen: false, modal: true, title: 'Search clients', position: [120,120],
          buttons:
          {
            'Find': function () { jQuery(this).trigger('submit'); },
            Cancel: function () { jQuery(this).dialog('close'); }
          },
        })
        .bind('submit', function(event) { Dlog_Post( event ); });
                    
    // open it
    jQuery('#ItemId-dlog').dialog('open');
  }

20/06/2010
12:11
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Not sure but you shoud define close event in the UI dialog and do

$(this).dialog( "destroy" );

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.

22/06/2010
15:53
Avatar
Gil
Member
Members
Forum Posts: 8
Member Since:
22/04/2010
sp_UserOfflineSmall Offline

tony said:

Hello,

Not sure but you shoud define close event in the UI dialog and do

$(this).dialog( "destroy" );

Regards

Tony


 Tony,

I tried this, but the result was the same. Also, I have sent you an email with some additional information. I hope it was not intercepted by a spam filter.

Regards,

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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