2015-10-23 36 views
0

嗨我有一個小部件,當點擊一個按鈕時彈出,在這個小部件上提供了一些數據。我創建了一個複選框調用archiveLog。當這個複選框被選中時,我想要渲染數據。這裏是我有:jquery複選框呈現變化數據

dataServiceStudy.getLogsByStudyId(studyId) 
       .done(function (result) { 
        if (result) { 
         var studyLogTitle = "something " + somethingId; 
         var modalDiv = "somethingLog" + somethingId; 
         modalsHelper.getModalPartial("/loc1/subloc1/subsubloc1", 
         null, 
         new Object(), 
         { "height": "400", "width": "750", "name": modalDiv, "title": somethingLogTitle }) 
         .done(function() { 
          renderStudyLogGrid(); 
          $("#archiveLog").change(function() { 
           if (this.checked) { 
            bindStudyLog(result); 
           } 
          }) 
          //bindStudyLog(result); 
          $('#closeStudyLog').click(function() { 
           $('#' + modalDiv).dialog('close'); 
          }); 
         }); 
        } 
       }); 

當複選框是選中的數據不會出現

編輯****

我希望它刷新電網一旦其檢查

回答

1

變化:

$("#archiveLog").on(function() { 
    if (this.checked) { 
     bindStudyLog(result); 
    } 
}) 

有:

$("#archiveLog").change(function() { 
    if ($(this).is(':checked')) { 
     bindStudyLog(result); 
    } else { 
     //hide block 
    } 
}) 
1

應該變化

$("#archiveLog").change(function() { 

     //Add your logic here 

    });