Is it possible to retrieve lists with template "Custom List" and display it in a jqxListBox or div?
2 Answers
Below is a sample code to get you started. The rest end point used in the request below will return lists based on Template 100 (Generic List)
<div id="jqxListBox"> </div>
<script>
var webUrl= _spPageContextInfo.webAbsoluteUrl;
var myList=[];
myList.push("<ul>");
$.ajax({
url: webUrl+"/_api/web/lists?$filter=BaseTemplate%20eq%20100",
method: "GET",
headers: {
"accept": "application/json;odata=verbose",
},
success: function (data) {
$(data.d.results).each(function () {
myList.push("<li>" + $(this)[0].Title + "</li>");
});
myList.push("</ul>");
$("#jqxListBox").append(myList.join(''));
}
});
</script>
-
Thankyou! The only thing i had to modify was the url: _spPageContextInfo.siteAbsoluteUrl + "/_api/web/lists?$filter=BaseTemplate%20eq%20100", Nov 25, 2015 at 14:28
SPSiteDataQuery sdq = new SPSiteDataQuery();
sdq.Lists = "<Lists ServerTemplate=\"101\" />";//specify template id here
sdq.ViewFields = "<ListProperty Name=\"Title\" /><FieldRef Name=\"Physical_x0020_Location\" /><FieldRef Name=\"LinkFilename\" />";
sdq.Webs = "<Webs Scope=\"Recursive\">";
dt = web.GetSiteData(sdq);
-
2This does not show how to list lists of a certain type in a list Nov 25, 2015 at 9:56
-