Skip to content

Commit

Permalink
Grouping: Add "monthyear" grouping to dates. Fixes #744
Browse files Browse the repository at this point in the history
  • Loading branch information
Mottie committed Oct 10, 2014
1 parent 3c0380c commit ad85121
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions docs/example-widget-grouping.html
Expand Up @@ -398,6 +398,10 @@ <h4>Group header class names (when changing the grouping, notice that the <em>so
<td><code>&quot;group-date-month&quot;</code><span class="remark">*</span></td>
<td>Group the rows by month.</td>
</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>
<td><code>&quot;group-date-week&quot;</code><span class="remark">*</span></td>
<td>Group the rows by day of the week.</td>
Expand Down Expand Up @@ -505,7 +509,7 @@ <h1>HTML</h1>
numcol = 2,
letcol = 4,
datecol = 7,
dateGroups = [ '', 'year', 'month', 'day', 'week', 'time' ];
dateGroups = [ '', 'year', 'month', 'monthyear', 'day', 'week', 'time' ];
// Numeric column slider
$( "#slider0" ).slider({
value: startBlock,
Expand Down Expand Up @@ -550,7 +554,7 @@ <h1>HTML</h1>
$( "#slider2" ).slider({
value: curGroup,
min: 0,
max: 5,
max: dateGroups.length - 1,
step: 1,
create: function(){
$('.dateclass').html(' "group-date' + (curGroup > 0 ? '-' + dateGroups[curGroup] : '') + '"');
Expand Down
1 change: 1 addition & 0 deletions js/widgets/widget-grouping.js
Expand Up @@ -43,6 +43,7 @@ ts.grouping = {
hours = time.getHours();
return part === 'year' ? time.getFullYear() :
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 === 'week' ? wo.group_week[time.getDay()] :
part === 'time' ? ('00' + (hours > 12 ? hours - 12 : hours === 0 ? hours + 12 : hours)).slice(-2) + ':' +
Expand Down

0 comments on commit ad85121

Please sign in to comment.