2010-08-24 8 views
0

Problème de récurrence. Firebug dit ligne 600:Problème de récurrence trop important

// Recurse if we're merging object values 
    if (deep && copy && typeof copy === "object" && !copy.nodeType) 
    target[name] = jQuery.extend(deep, 
    // Never move original objects, clone them 
    src || (copy.length != null ? [] : {}) 
    , copy); // <--- Line 600 

Voici source:

$(function() { 
    var $gallery = $('#gallery'), $matcher = $('#matcher'); 

    $('.rotatorImage', $gallery).draggable({ revert: 'invalid', helper: 'clone', appendTo: 'body', cursor: 'move' }); 

    $('.rotatorImage', $galleryItems).draggable({ revert: 'invalid', helper: 'clone', appendTo: 'body', cursor: 'move' }); 

    $matcher.droppable({ 
    accept: '#gallery .rotatorImage, #galleryItems .rotatorImage', drop: function(ev, ui) { 
     copyProduct(ui.draggable, $matcher); 
    } 
    }); 

    function copyProduct($item, section) { 
    if (section.children().length == 0) { 
     var cloneID = 'clone_' + $item.attr('id'); 
     var existing = $('#' + cloneID); 
     if (existing.length == 0) { 
      // then allow it to be created 
      var clone = $item.clone(); 
      clone.attr('id', cloneID); 
      clone.append('<div class="RemoveMatcherItem"><a href="javascript: RemoveItem(\'' + clone.attr('id') + '\');" class="greenlink">x</a></div>').appendTo(section); 
      SaveChanges(); 
     } 
    } 
    else 
     alert('Only one product is allowed at a time for this section.'); 
    } 
}); 

function RemoveItem(cloneID) { 
    $('#' + cloneID).remove(); 
    SaveChanges(); 
} 

function SaveChanges() { 
    SaveMatches(); 
    __doPostBack('<%=lnkSaveMatches.UniqueID%>', '') 
} 

function SaveMatches() { 
    var $rotImg = $('#matcher').find('.rotatorImage'); 

    if ($rotImg.length > 0) { 
     $rotImg.each(function() { 
      var hdn = $('#<%=hdnMatcherID.ClientID%>'); 
      hdn.val($(this).attr('productID')); 
     }); 
    } 
    else 
     $('#<%=hdnMatcherID.ClientID%>').val(''); 
} 

<asp:HiddenField ID="hdnMatcherID" runat="server" /> 
<asp:LinkButton ID="lnkSaveMatches" runat="server" OnClientClick="return SaveMatches();" OnClick="lnkSaveMatches_Click" Text="" /> 
<div id="matcher" class="matcher_" style="width: 120px; height: 120px; border: solid 1px; padding-left: 0px;"> 
    <div class="rotatorImage ui-draggable" id='clone_pid_<%# Eval("ProductID") %>' productid='<%# Eval("ProductID") %>'> 
    <div style="height: 120px;"> 
     <asp:Image ID="imgProduct" runat="server" Width="120" /><br /> 
    </div> 
    <div class="RemoveMatcherItem"><a href="javascript: RemoveItem('clone_pid_<%# Eval("ProductID") %>');" class="greenlink">x</a></div> 
    </div> 
</div> 

protected void lnkSaveMatches_Click(object sender, EventArgs e) { 
    int matchID = hdnMatcherID.Value == "" ? 0 : Convert.ToInt32(hdnMatcherID.Value); 

    Suggestion.UpdateSuggestionItem(matchID); 
} 

Toutes les idées sur où je suis frappé mon problème de récursivité?

+0

Pourquoi est-ce marqué C#? – NullUserException

+0

Je supprime la balise C#. Aussi, ne pas être pédant, mais le mot est "récurrence", pas "recurse". –

+0

Marqué C# car il incluait du code C#. Mes excuses pour le mis-tag. – pherbio

Répondre

0

J'ai trouvé la solution à mon problème.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> 

Changé à:

<script type="text/javascript" src="js/jquery/jquery-ui-1.7.2.js"></script> 

Merci à tous ceux qui ont aidé.

Questions connexes