views:

29

answers:

1

I have a table with rows which can be deleted by clicking on an icon next to each row. When the icon is clicked a confirmation dialog appears asking the user to confirm.

Whichever action is taken (Yes, No, X) causes a Too Much Recursion error. The function works, in that the row is deleted, and the dialog closes, but it causes the TMR error and eats up Firefox memory.


$('a img.delete').live('click', function(event){
rowid = this.name;$('#' + rowid).addClass('ui-state-highlight');
$("#dialog-del-r").dialog('open');
return false;
});

 $("#dialog-del-r").dialog({autoOpen:false,height:225,width:250,modal:false,position:[700,150],
buttons: {'Yes': function() {
   $('#summary-report').empty();
   $('#' + rowid).remove();
   $(this).dialog('close');
  },
  'No': function() {
   $('#' + rowid).removeClass('ui-state-highlight');
   $(this).dialog('close');
  }}
  ,close: function() {
   $('#' + rowid).removeClass('ui-state-highlight');
   $(this).dialog('close');
  }
 });

Any of these lines $(this).dialog('close'); cause the problem to happen.

I also have a form reset button which does exactly the same thing:


 $('#reset-form').button({icons: {primary:'ui-icon-trash'}}).click(function(){
$('#dialog-reset').dialog('open');
});

 $("#dialog-reset").dialog({autoOpen:false,height:225,width:250,modal:false,position:[200,350],buttons: {'Yes': function() {$(this).dialog('close');location.reload(true);},'No': function() {$(this).dialog('close');}},close: function() {$(this).dialog('close');}});
A: 

I managed to work this one out. The close, section closes the dialog automatically whereas I had the dialog('close') in there.



  ,close: function() {
   $('#' + rowid).removeClass('ui-state-highlight');
   $(this).dialog('close');
  }

should be:



  ,close: function() {
   $('#' + rowid).removeClass('ui-state-highlight');
  }


Larry David