2

Is it possible to retrieve lists with template "Custom List" and display it in a jqxListBox or div?

2 Answers 2

2

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>
1
  • Thankyou! The only thing i had to modify was the url: _spPageContextInfo.siteAbsoluteUrl + "/_api/web/lists?$filter=BaseTemplate%20eq%20100",
    – pretta118
    Nov 25, 2015 at 14:28
0
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);
2
  • 2
    This does not show how to list lists of a certain type in a list Nov 25, 2015 at 9:56
  • And its server side code, you don't have SPSiteDataQuery CSOM Nov 25, 2015 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.