I have a list in SharePoint 13. The list is customized using Data table.Currently I have three filters with dropdown option. I want to select multiple option in the dropdown and show the result in the list. Below is the code used:
<div class="" style="float:right; padding:0px 5px 5px 0px;"><a href="javascript:resetFilters()">Reset filters</a></div>
<br/><br/>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="display" id="theResults">
<thead>
<th width="20%">Date</th>
<th width="20%">Category</th>
<th width="60%">Title and description</th>
</thead>
</table>
<script type="text/javascript">
function loadTable(theFilter,flag) {
if(theFilter != '&$filter=') {
theFilter += " and ";
}
theFilter += "Category ne ''";
//theFilter += "$orderby=Date";
// theFilter += "(SupportType eq 'none')&$orderby=sortorder";
var call = $.ajax({
url: strURL + theFilter,
type: "GET",
dataType: "json",
headers: {
Accept: "application/json;odata=verbose"
}
});
call.done(function (data,textStatus, jqXHR) {
if(flag==true) {
for (i = 0; i < fieldlist.length; i++) {
$( 'select[name="' + fieldlist[i][0]+ '"]' ).append( createFilters(data,fieldlist[i][0]) );
}
}
$('#theResults').dataTable({
"bDestroy": true,
"bProcessing": true,
"sScrollY": "800px",
"aLengthMenu": [[20, 40, 60], [20, 40, 60]],
"iDisplayLength": 20,
"aaData": data.d.results,
"aaSorting": [[0, 'desc']],
"aoColumns": [
{ "mData": "Date", "sDefaultContent": "" },
//{ "mData": "Country_x0020_of_x0020_Origin", "sDefaultContent": "" },
{ "mData": "Category", "sDefaultContent": "" },
//{ "mData": "Industry", "sDefaultContent": "" },
{ "mData": "Title0", "sDefaultContent": "" },
]
});
});
call.fail(function (jqXHR,textStatus,errorThrown) {
alert("Error retrieving Tasks: " + jqXHR.responseText);
});
}
var fieldlist = [ ["Country_x0020_of_x0020_Origin","Source"], ["Category"], ["Industry","Industry/Sector"] ]
var filterField = "";
var filterText = "";
/* SharePoint list URL*/
var strURL = "list_URL')/items?$top=1000";
builddropdowns();
filterPipeline();
</script>