SPTechCon Boston 2015 - Overcoming SharePoint Limitations

15
© 2003-2014 PAIT Group Overcoming SharePoint Limitations Creating List Views for Large Lists Mark Rackley [email protected] SPTechCon Boston

Transcript of SPTechCon Boston 2015 - Overcoming SharePoint Limitations

Page 1: SPTechCon Boston 2015 - Overcoming SharePoint Limitations

© 2003-2014 PAIT Group

Overcoming SharePoint LimitationsCreating List Views for Large Lists

Mark [email protected] Boston

Page 2: SPTechCon Boston 2015 - Overcoming SharePoint Limitations

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

Page 3: SPTechCon Boston 2015 - Overcoming SharePoint Limitations

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

Page 4: SPTechCon Boston 2015 - Overcoming SharePoint Limitations

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

Page 5: SPTechCon Boston 2015 - Overcoming SharePoint Limitations

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

Page 6: SPTechCon Boston 2015 - Overcoming SharePoint Limitations

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

Page 7: SPTechCon Boston 2015 - Overcoming SharePoint Limitations

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"

}});

Page 8: SPTechCon Boston 2015 - Overcoming SharePoint Limitations

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" }});

Page 9: SPTechCon Boston 2015 - Overcoming SharePoint Limitations

DEMO: Using rest to query large lists

Page 10: SPTechCon Boston 2015 - Overcoming SharePoint Limitations

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.

Page 11: SPTechCon Boston 2015 - Overcoming SharePoint Limitations

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

});

Page 12: SPTechCon Boston 2015 - Overcoming SharePoint Limitations

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

views

Page 13: SPTechCon Boston 2015 - Overcoming SharePoint Limitations

What else can we do??

• Filtering• Grouping of data

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

Page 14: SPTechCon Boston 2015 - Overcoming SharePoint Limitations

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

Page 15: SPTechCon Boston 2015 - Overcoming SharePoint Limitations

Mark [email protected]@mrackley