Hello Sultan,
Ok so I tried your code but it's not loading the dialog. I made some
changes to the html so I made changes to the refreshHandlers. I also
changed it so it loads showEditDialog in div#edit and
showDeleteConfirmDialog in div#del. Each will contain different submit
form. Right now I'm trying to implement the showDeleteConfirmDialog so
I haven't made any changes to the showEditDialog.
I also have some code to pass the users name to a "span" tag in the
dialog window and also passing the user id to a hidden input field.
I can't seem to figure out what is preventing the dialog from popping
up.
I have underneath the code and html.
<script type="text/javascript">
TOOLKIT = {
that : this,
refreshHandlers : function() {
$('#members t...@class=edit] a').each(function() {
$(this).unbind('click', showEditDialog);
$(this).bind('click', function(){
showEditDialog.call($(this).attr('id'));
});
});
$('#members t...@class=delete] a').each(function() {
$(this).unbind('click', showDeleteConfirmDialog);
$(this).bind('click', function(){
showDeleteConfirmDialog.call($(this).attr('id'));
});
});
},
showEditDialog: function(row_id){
$('#edit').dialog({
//
//
//
beforeclose: function(){
that.refreshHandlers()
}
});
// and do something with the current row :p
//var old = $('t...@id="' + row_id + '"')[SOME_FIELD].text();
},
showDeleteConfirmDialog: function(){
$('#del').dialog({
autoOpen: false,
show: 'blind',
hide: 'fold',
width: 400,
modal: true,
buttons: {
"Confirm": function() {
document.del-member.submit();
},
"Cancel": function() {
$(this).dialog('close');
}
}
//
//
//
beforeclose: function(){
that.refreshHandlers()
}
});
// and do something with the current row :p
var fname = $('t...@id="' + row_id + '" td.fname').text();
var lname = $('t...@id="' + row_id + '" td.lname').text();
var fullname = fname + " " + lname;
// add some stuff to the dialog's GUI etc....
$("#del span.name").html(fullname);
var row = row_id.split('_');
var id = row[1];
$("#del input#profile_id").val(id);
}
}
$(document).ready(function(){
TOOLKIT.refreshHandlers();
});
</script>
</head>
<body>
<table cellspacing="1" cellpadding="0" class="tbl-style">
<tbody id="members">
<tr id="uid_1">
<td class="fname">Jamie</td>
<td class="lname">Jefferson</td>
<td class="edit"><a href="#">edit</a></td>
<td class="delete"><a href="#">delete</a></td>
</tr>
<tr id="uid_2">
<td class="fname">Gavin</td>
<td class="lname">Wick</td>
<td class="edit"><a href="#">edit</a></td>
<td class="delete"><a href="#">delete</a></td>
</tr>
<tr id="uid_3">
<td class="fname">Sharon</td>
<td class="lname">Tower</td>
<td class="edit"><a href="#">edit</a></td>
<td class="delete"><a href="#">delete</a></td>
</tr>
</tbody>
</table>
<div id="del">
<form action="http://localhost/test/form-dialog.php" method="post"
id="del-member" name="del-member">
<p class="ui-state-error"><span class="ui-icon ui-icon-alert"
style="float:left; margin:0 7px 0 0;"></span> Please select the reason
for ending the membership of <span class="name"></span> !</p>
<span>Reason: </span>
<select name="reason">
<option value="None">None</option>
<option value="Retired">Retired</option>
</select>
<input type="hidden" id="profile_id" name="profile_id" value="" />
</form>
</div>
<div id="edit">
<form action="http://localhost/test/form-dialog.php" method="post"
id="edit-member" name="edit-member">
</form>
</div>
</body>
On Dec 10, 11:33 am, Sultan Imanhodjaev <[email protected]>
wrote:
> Hello moleculezz just look at the following example
>
> TOOLKIT = {
> that : this,
> refreshHandlers : function() {
> $('#container t...@id=edit]').each(function() {
> $(this).unbind('click', showEditDialog);
> $(this).bind('click', function(){
> showEditDialog.call($(this).attr('id'));});
> });
>
> $('#container t...@id=delete]').each(function() {
> $(this).unbind('click', showDeleteConfirmDialog);
> $(this).bind('click', function(){
> showDeleteConfirmDialog.call($(this).attr('id'));});
> });
> },
>
> showEditDialog: function(row_id){
> $('#edit').dialog({
> //
> //
> //
> beforeclose: function(){
> that.refreshHandlers()}
> });
>
> // and do something with the current row :p
> var old = $('t...@id="' + row_id + '"')[SOME_FIELD].text();},
>
> showDeleteConfirmDialog: function(){
> $('#edit').dialog({
> //
> //
> //
> beforeclose: function(){
> that.refreshHandlers()}
> });
>
> // and do something with the current row :p
> var old = $('t...@id="' + row_id + '"')[SOME_FIELD].text();
> // add some stuff to the dialog's GUI etc....
>
> }
> }
>
> // And at last just initiate instance :)
> $(document).ready(function() {
> TOOLKIT.refreashHandlers();
>
> })
>
> With best,
> Sultan Imanhodjaev
--
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en.