Grouping: Add "monthyear" grouping to dates. Fixes #744

This commit is contained in:
Mottie 2014-10-09 21:26:13 -05:00
parent 3c0380cad4
commit ad85121da0
2 changed files with 7 additions and 2 deletions

View File

@ -398,6 +398,10 @@ group_dateString : function(date) {
<td><code>&quot;group-date-month&quot;</code><span class="remark">*</span></td> <td><code>&quot;group-date-month&quot;</code><span class="remark">*</span></td>
<td>Group the rows by month.</td> <td>Group the rows by month.</td>
</tr> </tr>
<tr>
<td><code>&quot;group-date-monthyear&quot;</code><span class="remark">*</span></td>
<td>Group the rows by month &amp; year.</td>
</tr>
<tr> <tr>
<td><code>&quot;group-date-week&quot;</code><span class="remark">*</span></td> <td><code>&quot;group-date-week&quot;</code><span class="remark">*</span></td>
<td>Group the rows by day of the week.</td> <td>Group the rows by day of the week.</td>
@ -505,7 +509,7 @@ group_dateString : function(date) {
numcol = 2, numcol = 2,
letcol = 4, letcol = 4,
datecol = 7, datecol = 7,
dateGroups = [ '', 'year', 'month', 'day', 'week', 'time' ]; dateGroups = [ '', 'year', 'month', 'monthyear', 'day', 'week', 'time' ];
// Numeric column slider // Numeric column slider
$( "#slider0" ).slider({ $( "#slider0" ).slider({
value: startBlock, value: startBlock,
@ -550,7 +554,7 @@ group_dateString : function(date) {
$( "#slider2" ).slider({ $( "#slider2" ).slider({
value: curGroup, value: curGroup,
min: 0, min: 0,
max: 5, max: dateGroups.length - 1,
step: 1, step: 1,
create: function(){ create: function(){
$('.dateclass').html(' "group-date' + (curGroup > 0 ? '-' + dateGroups[curGroup] : '') + '"'); $('.dateclass').html(' "group-date' + (curGroup > 0 ? '-' + dateGroups[curGroup] : '') + '"');

View File

@ -43,6 +43,7 @@ ts.grouping = {
hours = time.getHours(); hours = time.getHours();
return part === 'year' ? time.getFullYear() : return part === 'year' ? time.getFullYear() :
part === 'month' ? wo.group_months[time.getMonth()] : part === 'month' ? wo.group_months[time.getMonth()] :
part === 'monthyear' ? wo.group_months[time.getMonth()] + ' ' + time.getFullYear() :
part === 'day' ? wo.group_months[time.getMonth()] + ' ' + time.getDate() : part === 'day' ? wo.group_months[time.getMonth()] + ' ' + time.getDate() :
part === 'week' ? wo.group_week[time.getDay()] : part === 'week' ? wo.group_week[time.getDay()] :
part === 'time' ? ('00' + (hours > 12 ? hours - 12 : hours === 0 ? hours + 12 : hours)).slice(-2) + ':' + part === 'time' ? ('00' + (hours > 12 ? hours - 12 : hours === 0 ? hours + 12 : hours)).slice(-2) + ':' +