This is the code for Chapter 8, Figure 5 from D3.js in Action for a spreadsheet with row and column sorting.