2016-08-09 6 views
0

私はグリッドの完全なコードを持っています。このPICTUREでわかるように、私はjqgridの中に画像ボタンタイプを持っています。画像ボタンを無効にしたい場合StatusPendingではなく、Pendingステータスであればボタンが有効になります。私は*.attr("disabled",true);が動作していない下のコードについては、私はまだ私のボタンをクリックして、それが機能をトリガすることができます。私は<= jquery 1.8.2 jqueryのバージョンを使用しています。私は*.prop("disabled",true)を使用している場合どのようにJavaScriptの画像ボタンを無効にするには?

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 + ")' />"

とその作業罰金を追加私の答えです。

関連する問題