2016-08-09 2 views
0

나는이 그리드 코드를 가지고있다. 이 PICTURE에서 볼 수 있듯이 jqgrid 내에 이미지 버튼 유형이 있습니다. 이미지 버튼이 Status이 아닌 경우 Pending이 아니고 버튼이 활성화되어있는 경우 Pending 상태에 있어야합니다. 아래의 코드는 *.attr("disabled",true);이 작동하지 않는 경우에도 계속 내 버튼을 클릭 할 수 있으며 함수를 트리거합니다. 나는 <= jquery 1.8.2 버전의 jquery를 사용하고있다. 내가 *.prop("disabled",true)를 사용하는 경우자바 스크립트에서 이미지 버튼을 사용 중지하는 방법은 무엇입니까?

function FiTATimeCorrectionV2(FAId, drpStatus) { 
    var url1 = '../Request/GetFitaTimeCorrectionV2?FAId=' + FAId + '&drpStatus=' + drpStatus; 
    $("#FiTATimeCorrectionV2List").jqGrid({ 
     url: url1, 
     datatype: 'json', 
     mtype: 'POST', 
     colNames: ['rowId', 'FitaAssignDtlID', 'FitaAssignID', 'Date', 'Time In1', 'Time Out1', 'Time In2', 'Time Out2', 'Time In1', 'Time Out1', 'Time In2', 'Time Out2', 'Remarks', 'Status', '', ''], 
     colModel: [ 
       { name: 'rowId', index: 'rowId', hidden: true, width: 20 }, 
       { name: 'FitaAssignDtlID', index: 'FitaAssignDtlID', hidden: true, editable: true, sortable: false, width: 20, align: 'center' }, 
       { name: 'FitaAssignID', index: 'FitaAssignID', hidden: true, editable: true, sortable: false, width: 90, align: 'center' }, 
       { name: 'Date', index: 'Date', hidden: false, editable: true, sortable: false, width: 85, align: 'center' }, 
       { name: 'FitaIn1', index: 'FitaIn1', width: 70, align: 'center' }, 
       { name: 'FitaOut1', index: 'FitaOut1', width: 70, align: 'center' }, 
        { name: 'FitaIn2', index: 'FitaIn2', width: 70, align: 'center' }, 
       { name: 'FitaOut2', index: 'FitaOut2', width: 70, align: 'center' }, 
        { name: 'FitaCorIn1', index: 'FitaCorIn1', width: 70, align: 'center' }, 
       { name: 'FitaCorOut1', index: 'FitaCorOut1', width: 70, align: 'center' }, 
        { name: 'FitaCorIn2', index: 'FitaCorIn2', width: 70, align: 'center' }, 
       { name: 'FitaCorOut2', index: 'FitaCorOut2', width: 70, align: 'center' }, 
       { name: 'FitaCorRemarks', index: 'FitaCorRemarks', width: 73, align: 'center' }, 
       { name: 'FitaStatus', index: 'FitaStatus', width: 70, align: 'center' }, 
       { name: 'FitaCorForApproval', index: 'FitaCorForApproval', width: 50, align: 'center' }, 
       { name: 'FitaCorForDisApproval', index: 'FitaCorDisForApproval', width: 50, align: 'center' }, 
    ], 
     pager: $('#FiTATimeCorrectionV2Pager'), 
     rowNum: 5, 
     rowList: [5, 10, 20], 
     sortname: 'FADate', 
     sortorder: 'desc', 
     viewrecords: true, 
     imgpath: '/Content/themes/redmond/images/', 
     height: '100%', 
     afterInsertRow: function (rowid) { 
      var obj = jQuery("#FiTATimeCorrectionV2List").getRowData(rowid); 
      var FADTLSID = obj.FitaAssignDtlID; 
      if (FADTLSID !== undefined) { 
       if (FADTLSID !== "") { 
        var btnApprove = "<img alt='' src='../../Content/Images/newimages/check.png' style='height:20px;width:20px;' style ='width: 90px' id='btnApproved" + rowid + "' onclick='clickmeapproved(" + rowid + ")' />" 
        var btnDisApprove = "<img alt='' src='../../Content/Images/newimages/delete.png' style='height:20px;width:20px;' style ='width: 90px' id='btnDisApproved" + rowid + "' onclick='clickmedisapproved(" + rowid + ")' />" 
        jQuery("#FiTATimeCorrectionV2List").setRowData(rowid, { FitaCorForApproval: btnApprove }); 
        jQuery("#FiTATimeCorrectionV2List").setRowData(rowid, { FitaCorForDisApproval: btnDisApprove }); 
        var temp = obj.FitaStatus; 
        if (temp == "Approved") { 
        $("#btnApproved" + rowid).attr("disabled", true); 
        $("#btnDisApproved" + rowid).attr("disabled", true); 
        } 
        else if (temp == "Disapproved") { 
         $("#btnApproved" + rowid).hide(); 
         $("#btnDisApproved" + rowid).hide(); 
        } else { 
        $("#btnApprove" + rowid).attr("disabled", false); 
         $("#btnDisApprove" + rowid).attr("disabled", false); 
        } 
       } 
      } 
     }, 
     loadComplete: function() { 
      var ids = jQuery("#FiTATimeCorrectionV2List").getDataIDs(); 
      var len = ids.length;    
      if (len < 5) { 
       AddNewRowToGrid(len, "#FiTATimeCorrectionV2List"); 
      } 
     } 
    }); 

는이 오류가 나는 해결책을 발견 내 게시물을 볼 모든 사람에게 Uncaught TypeError: $(...).prop is not a function

답변

0

을 얻었다. 나는 처음부터 그것을 시도해야하지만 그것이 효과가 있다면 나는이다. 하지만 지금은 내 문제를 해결합니다.

여기에 내가 지금 input type='image'

var btnApprove = "<input type = 'image' img alt='' src='../../Content/Images/newimages/check.png' style='height:20px;width:20px;' style ='width: 90px' id='btnApproved" + rowid + "' onclick='clickmeapproved(" + rowid + ")' />"

과 그 작업 벌금을 추가 내 대답이다.

관련 문제