I'm trying to build a projects dashboard page of sorts, with HTML Form Filter Web Parts that will allow the user to select from filters, and have those filters connected to various document and list web parts on the page (risks, issues, open items, etc.).
I've got the following code which populates all of the project names to a dropdown list. This filter is working fine, but at present I only have a 'Clear All Filters' button (elsewhere on the page). Is there a way to add an 'All Projects' item to my dropdown list that would effectively clear this filter when applied? I plan on adding other filters (project owner, status, etc.), so the 'Clear All Filters' button doesn't seem like an optimal solution if the user wants to preserve the other filters that have been set.
Thanks in advance!
function getListItemsForDropDown(){
$().SPServices({
operation:"GetListItems",
webURL: $(this).attr("WebFullUrl"),
async:false,
listName: "Project List",
CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",
CAMLQuery: "<Query><OrderBy><FieldRef Name='Title' Ascending='True' /></OrderBy></Query>",
completefunc: function(xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function() {
projName = $(this).attr("ows_Title");
listItem = "<option>" + projName + "</option>"
$("select.list-selector").append(listItem);
})
}
})
} // end function