2016-10-20 6 views
0

URLを別の.aspxページに渡すためにJQUERYデータテーブルから非表示の列値PIDを取得する方法FirmsDeatilsの人物&の詳細な説明を表示できます.aspxページ。どんなヘルプも素晴らしいでしょう。Jquery DataTableから隠し列の値を取得する方法1.10.12

'render': function(data, type, row, meta) { 
    var id = row['PID']; 
    return '<a href="FirmsDeatils.aspx?=' + id + '">' + data + '</a>'; 
} 

答えて

0

は、以下のコードを使用してください。それは完璧に動作します。ここに私のコードは間違いなく他の人を助けるだろう。
+0

こんにちはGyrocode.com:

<script type="text/javascript"> $(document).ready(function() { $.ajax({ // url: 'FirmDetailService.asmx/GetFirmDetails', url: '<%= ResolveUrl("FirmDetailService.asmx/GetFirmDetails")%>', method: 'post', dataType: 'json', success: function(data) { $('#example').DataTable({ //paging:false, //ordering : false, searchHighlight: true, lengthChange: false, data: data, columns: [{ 'data': 'PID', visible: false }, { 'data': 'PersonName', 'render': function(PersonName) { var id = ? ? ? ? ; return "<a href= FirmsDeatils.aspx?=" + id + '>' + PersonName + '</a>'; } }, { 'data': 'CID', visible: false }, { 'data': 'CompanyName' }, { 'data': 'City' }, { 'data': 'Country' }, ] }); } }); }); </script> </head> <body> <table id="example" class="display" cellspacing="0" width="100%"> <thead> <tr> <th>PID</th> <th>PersonName</th> <th>CID</th> <th>CompanyName</th> <th>City</th> <th>Country</th> </tr> </thead> </table> </body> </html> 

0
<script type="text/javascript"> 
$(document).ready(function() { 

    $.ajax({ 
     // url: 'FirmDetailService.asmx/GetFirmDetails', 
     url: '<%= ResolveUrl("FirmDetailService.asmx/GetFirmDetails")%>', 
     method: 'post', 
     dataType: 'json', 
     success: function (data) { 
     $('#example').DataTable({ 

       //paging:false, 
       //ordering : false, 
       searchHighlight: true, 
       lengthChange:false , 
       data: data, 
       'columns': [ 
         { 'data':'PID', 'visible' : false}, 

         {'data' : 'PersonName', 
         'render': function (data, type, row, meta) { 
          var id = row['PID']; 
      return '<a href="FirmsDeatils.aspx?=' + id + '">' + data + '</a>'; 
         } 

        }, 
        { 'data': 'CID', 'visible' :false }, 
        { 'data': 'CompanyName'}, 
        { 'data': 'City' }, 
        { 'data': 'Country' }, 
       ] 

     } 

      ); 

     } 
    }); 
} 
); 
</script> 
<body> 
<table id="example" class="display" cellspacing="0" width="100%"> 
    <thead> 
     <tr> 
      <th>PID</th> 
      <th>PersonName</th> 
      <th>CID</th> 
      <th>CompanyName</th> 
      <th>City</th> 
      <th>Country</th> 
     </tr> 
    </thead> 
</table> 
</body> 
</html> 
関連する問題