PrimeRevenue/tent — pull request #393 by benrosenblum (2013-12-09 21:41:21+00:00)
Title: In-line grouping and subgrouping for grid

## DO NOT MERGE
code review only, can merge after new dm-grape and smore are in gemfury and some qunit tests have been added for the group_pager (Dec 10, in the AM)
---

This branch implements inline grouping and subgrouping for the tent jqgrid. See ```group_pager.coffee``` for the bulk of the multi-paging functionality.

The inline grouping requires pagination at 4 separate levels, each managed with their own requests to the server aside from the last: the top level groups, the subitems of the top level which may also be groups, and the subitems of the subgroups if there is secondary grouping, and the overall paging of the entire merged dataset for final display in the grid.

To accomplish this, there is a top level array for managing all the records. All loaded records are cached unless the containing group or subgroup is collapsed.

When grouping first begins, the first page of group records are requested from the server. The new server-side functionality returns sub-item row counts for each group. When a group is expanded, empty subitem metadata records are created for each subitem in the group based on the group's subitem row count. When the data is available from a server response, these placeholders are then replaced with the loaded records.

Upon pagination at the grid level, for instance when a user clicks the next button on the pager, the cache is inspected throughout the range of requested rows. If a non-loaded placeholder record is found, a request is initiated to the server and the collection's ```modelData.isLoaded``` flag is set to false to ensure the loading indicator is displayed. We skip all remaining non-loaded rows in the page range unless we find a non-loaded row of different configuration (for instance, subitems of a different group), in which case an additional server request is initiated.

In this way, a page of data can have subitem records from multiple groups or subgroups, and appropriate server requests are initiated to load all visible data.

__Requirements and Limitations__

To function, this needs the new versions of dm-grape and SMore, new version numbers pending.

Additionally, the application using it should have CSS background styles defined for ```table.grid-table > tbody > tr.subgroup-expanded``` and ```table.grid-table > tbody > tr.subgroup-collapsed``` to style the subgroup headers appropriately.

We still need to design an appropriate UI for displaying the currently active grouping constraints.

---

__General Requirements__
- [ ] Pull Request contains full description of changes
- [ ] Link to the Pivotal Tracker story
- [ ] Rebased against latest master branch
- [ ] There are no `-1` code reviews (can only be overridden by Kyle)

---

__Coding Standards__
- [ ] Style guidelines are followed, code has been formatted
- [ ] Code follows idiomatic language paradigms

---

__Testing__
- [ ] Test coverage has not decreased
- [ ] There is no performance degradation
- [ ] All appropriate automated tests are present
- [ ] Appropriate seed data exists

---

__UI/UX__
- [ ] applicable (UI/UX has been changed)
- [ ] reviewed for usability and design

***

__Shared Project / Dependencies__
- [ ] Reviewed by Architect
- [ ] API changes to shared components documented on wiki
- [ ] 3rd-party library introduced:
- [ ] Version Dependencies identified