I found this great tutorial to use REST calls to retrieve SharePoint list items as an array of JSON objects posted by Mark.Rackley (Mark Rackley.). It is working, but I would like to add a new functionality, but I don't get it to work.
function LoadAIP(state)
{
var call = $.ajax({
url: "https://xxxx/xxxx/_vti_bin/listdata.svc/AIPList?
$select=ROCode,AIP,PIC&$filter=(ROCode eq '"+state+"')&$top=5000",
type: "GET",
dataType: "json",
headers: {
Accept: "application/json;odata=verbose"
}
});
call.done(function (data,textStatus, jqXHR){
$('#example').dataTable( {
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aaData": data.d.results,
"aoColumns": [
{ "mData": "ROCode" },
{ "mData": "AIP" },
{ "mData": "PIC" }],"bRetrieve": true,
"sDom": '<"H"Tfr>t<"F"ip>',
"oTableTools": {
"aButtons": [ "xls"],
"sSwfPath": ../js/datatables/TableTools/media/swf/copy_csv_xls_pdf.swf",
"bFilter": true}
} );
});
call.fail(function (jqXHR,textStatus,errorThrown){
alert("Error retrieving Tasks: " + jqXHR.responseText);
});
}
They way this is set up, initially the table is empty, how can I change this to show all the records by default when the page is loaded, and then apply the filters? Thanks!