2013-02-07 88 views
1
TableHandler.prototype.IsAlreadySelected = function(dataToCheck) 
{ 
    var _this = this; 

    if (_this.NewTemplateUsageSelected.length > 0) 
    { 
     var len = _this.NewTemplateUsageSelected.length; 
     for (var i = 0; i < len; i++) 
     { 
      var an = _this.NewTemplateUsageSelected[i]; 
      var isTemplateUsageDataDuplicate=false; 
      var isNonApplicableCGDataDuplicate=false; 
      if ((an.CustomerName == dataToCheck.CustomerName) && 
       (an.ProgramName == dataToCheck.ProgramName) && 
       (an.WorkpackageName == dataToCheck.WorkpackageName) && 
       (an.ActivityName == dataToCheck.ActivityName) && 
       (an.SelectedWorkFlowType == dataToCheck.SelectedWorkFlowType) && 
       (an.SelectedWorkFlowCategory == dataToCheck.SelectedWorkFlowCategory) && 
       (an.ReWorkflow== dataToCheck.ReWorkflow) && 
       (an.AllowCheckGroupSelection == dataToCheck.AllowCheckGroupSelection) && 
       (an.InitiatorGroupSelection == dataToCheck.InitiatorGroupSelection) && 
       (an.R1GroupSelection == dataToCheck.R1GroupSelection) && 
       (an.R2GroupSelection == dataToCheck.R2GroupSelection) && 
       (an.R3GroupSelection == dataToCheck.R3GroupSelection) && 
       (an.R4GroupSelection == dataToCheck.R4GroupSelection) &&  
       (an.InitiatorMinReworkEffort == dataToCheck.InitiatorMinReworkEffort) && 
       (an.R1MinReworkEffort == dataToCheck.R1MinReworkEffort) && 
       (an.R2MinReworkEffort == dataToCheck.R2MinReworkEffort) && 
       (an.R3MinReworkEffort == dataToCheck.R3MinReworkEffort) && 
       (an.R4MinReworkEffort == dataToCheck.R4MinReworkEffort) &&        
       (an.AllowFileAttachment == dataToCheck.AllowFileAttachment) && 
       (an.QualityReviewer== dataToCheck.QualityReviewer) && 
       (an.AllowLiabiltySelection == dataToCheck.AllowLiabiltySelection)&& 
       (an.SetToInactive == dataToCheck.SetToInactive)&& 
       (an.NonApplicabilityCheckGroupAllowed == dataToCheck.NonApplicabilityCheckGroupAllowed)) 
        { 
        istemplateusagedataduplicate=true; 
        } 

       var checkgroupslendataToCheck=dataToCheck.NonApplicableCheckGroupList.length;    
       var nalen=an.NonApplicableCheckGroupList.length; 
       if(checkgroupslendataToCheck == nalen) 
       { 
     for (var i = 0 ;i < checkgroupslendataToCheck ; i++) 
       { 

       var naDatatocheck= dataToCheck.NonApplicableCheckGroupList[i]; 
       var naData=an.NonApplicableCheckGroupList[i]; 
       if(   
            (naDatatocheck.INonApplicability == naData.INonApplicability)&& 
            (naDatatocheck.R1NonApplicability == naData.R1NonApplicability)&& 
            (naDatatocheck.R2NonApplicability == naData.R2NonApplicability) && 
            (naDatatocheck.R3NonApplicability == naData.R3NonApplicability)&& 
            (naDatatocheck.R4NonApplicability == naData.R4NonApplicability)) 
                    isNonApplicableCGDataDuplicate=true; 
            else 
            { 
            isNonApplicableCGDataDuplicate=false; 
            break; 
            } 

        } 
        if(isNonApplicableCGDataDuplicate==true && istemplateusagedataduplicate==true) 
        return true; 

       } 
       } 
       } 
       }; 

上述代碼導致錯誤Internet可能運行緩慢。當我找到一個解決方案,我得到了解決方案,如註冊表和IE版本的變化,將代碼移動到後臺,使用插件等。哪些在我們的項目中不可行。所以我必須改變上面的邏輯。JavaScript或jQuery中的任何內置函數,我可以用來競選兩個嵌套列表。Internet Explorer可能運行緩慢:要更改邏輯

回答

1

內循環需要使用一個不同的變量作爲它的計數器,否則它會使外循環無限地繼續。目前,你正在使用我的兩個循環。