This document discusses creating list views for large SharePoint lists. It begins with an introduction of the speaker and an overview of the agenda. It then covers the problems with large lists, such as losing functionality at the list view threshold of 5,000 items. It recommends preparing for large lists by using retention policies and indexing columns. It demonstrates using jQuery and REST to query large lists. Finally, it demonstrates creating interactive list views for large data sets using DataTables, bringing REST and DataTables together to build powerful views.
2. Mark Rackley / Partner & CTO
• 20+ years software architecture and
development experience
• Office 365 MVP, SharePoint Junkie
since 2007
• Event Organizer
(SharePointalooza.org)
• Blogger, Writer, Speaker
• Bacon aficionado
@mrackley
www.SharePointHillbilly.com
www.PaitGroup.com
www.SharePointaLooza.org
www.StratusForms.com
3. Agenda
• The Problem with large lists
• Prepare for Large Lists
• How to use REST to query large lists
• How to create easy to use list views for large lists using jQuery
4. DEMO: The problem with
large lists
• Be prepared before it affects you
5. The Problem with Large Lists
• There is a list view threshold
• You can’t change it in Office 365
• 5,000 items
• You lose some functionality when you reach the threshold
• Group By Views
• Sum / Totals on Views
• Lookup fields to large lists
• Manual filters on non-indexed columns
6. Prepare for Large Lists
• User a retention schedule to reduce number of
items in a list
• Index columns you wish to filter on
• You cannot index a column after the list exceeds
the list view threshold
• Use Content Types / Search with custom
display templates
7. How to use jQuery & REST to query large lists
Using verbose:
var call = $.ajax({
url: _spPageContextInfo.webAbsoluteUrl +
"/_api/Web/Lists/GetByTitle('MasterZipCode')/items?$select=Id,Title,zip,pri
mary_city,state,county,area_codes,timezone,latitude,longitude,estimated_p
opulation&$top=5000",
type: "GET",
dataType: "json"
headers: {
Accept: "application/json;odata=verbose"
}
});
8. How to use jQuery & REST to query large lists
Using minimalmetadata:
var call = $.ajax({
url: _spPageContextInfo.webAbsoluteUrl +
"/_api/Web/Lists/GetByTitle('MasterZipCode')/items?$select=Id,Title,zip,pri
mary_city,state,county,area_codes,timezone,latitude,longitude,estimated_p
opulation&$top=5000",
type: "GET",
dataType: "json",
headers: {
Accept:
"application/json;odata=minimalmetadata"
}
});
10. DataTables
• http://www.datatables.net/
• DataTables is a plug-in for the jQuery Javascript library. It is a
highly flexible tool, based upon the foundations of progressive
enhancement, which will add advanced interaction controls to any
HTML table.
11. DataTables – Basic Usage
//array of arrays
$('#example').dataTable( {
"aaData": [
["row 1","value"],
["row 2","value 2"],
],
"aoColumns": [ //field count must match column count
{ "sTitle": "Column Name" },
{ "sTitle": "Column Name 2" }
]
});
//array of objects
$('#example').dataTable({
"bProcessing": true,
"aaData": vendors, //array of objects
"aoColumns": [
{ "mData": "Vendor" }
]
});
12. DEMO: Creating a list view
with datatables
• Bringing REST and Datatables together to build list views
13. What else can we do??
• Filtering
• Grouping of data
https://jquery-datatables-row-grouping.googlecode.com
• Styling
• Adding click events