Jim Lobo Jim Lobo - 1 month ago 10
jQuery Question

How to get the Hidden column value from Jquery DataTable 1.10.12

How to get the hidden column value PID from JQUERY data table to pass in URL to another .aspx page Where I can show the detailed description of person & firms in FirmsDeatils.aspx page. Any Help would be great .

<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>

Answer

Use the code below:

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