SPTechCon Boston 2015 - Overcoming SharePoint Limitations

Post on 27-Jan-2017

735 views 3 download

Transcript of SPTechCon Boston 2015 - Overcoming SharePoint Limitations

© 2003-2014 PAIT Group

Overcoming SharePoint LimitationsCreating List Views for Large Lists

Mark Rackleymrackley@paitgroup.comSPTechCon Boston

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

@mrackleywww.SharePointHillbilly.comwww.PaitGroup.com www.SharePointaLooza.orgwww.StratusForms.com

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

DEMO: The problem with large lists• Be prepared before it affects you

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

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

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,primary_city,state,county,area_codes,timezone,latitude,longitude,estimated_population&$top=5000", type: "GET",

dataType: "json"headers: {

Accept: "application/json;odata=verbose"

}});

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,primary_city,state,county,area_codes,timezone,latitude,longitude,estimated_population&$top=5000", type: "GET", dataType: "json", headers: { Accept: "application/json;odata=minimalmetadata" }});

DEMO: Using rest to query large lists

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.

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" }]

});

DEMO: Creating a list view with datatables• Bringing REST and Datatables together to build list

views

What else can we do??

• Filtering• Grouping of data

https://jquery-datatables-row-grouping.googlecode.com• Styling• Adding click events

DEMO: Creating stylized, dynamic, useful list views • Let’s make something more usable

Mark Rackleymrackley@paitgroup.comwww.markrackley.net@mrackley