Forum



00:58

22/04/2010

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

Moderators
30/10/2007

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.
Most Users Ever Online: 715
Currently Online:
46 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