<table width="100%" cellpadding="0" cellspacing="0" border="0" class="display" id="example">
<thead>
<tr>
<th>Title</th>
<th>Id</th>
</tr>
</thead>
</table>
</div>
</body>
var call = $.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/Web/Lists/GetByTitle('listname')/items?$select=Title,Id,
type: "GET",
dataType: "json",
headers: {
Accept: "application/json;odata=verbose"
}
});
call.done(function (data,textStatus, jqXHR){
$('#example').dataTable({
"sDom": '<"H"Cfr>t<"F"ip>',
"bJQueryUI": true,
"bDestroy" : true,
"bProcessing": true,
"aaData": data.d.results,
"aoColumns": [
{ "mData": "Title",
"mData": "Id" }
]
});
});
Using above SharePoint REST API Code I am able to get all list items Title & id field in the datatable, however what I am looking for is how to add links to Title field which will take URL to DispForm.aspx?Id=?? page. Basically, trying to create a custom view which will have link to Title field and few other columns displayed in the datatable. I have just started using SharePoint REST API and datatable.js so not sure if it can be achieved. If someone knows or have a different idea please share.