better grouping options and display

allow collapsing groups
change 10000 to All (no limit)
This commit is contained in:
shaun 2018-05-03 11:42:31 +10:00
parent c878bd1148
commit efdd27d3d0
3 changed files with 55 additions and 13 deletions

View File

@ -233,6 +233,11 @@ namespace EmbyReports.Api
EnableTotalRecordCount = request.EnableTotalRecordCount
};
if (request.Limit == -1)
{
query.Limit = null;
}
if (!string.IsNullOrWhiteSpace(request.Ids))
{
query.CollapseBoxSetItems = false;

View File

@ -386,6 +386,7 @@
<label for="selectViewGrouping">Grouping</label>
<select id="selectReportGroup"></select>
<br />
<input type="checkbox" id="chkStartCollapsed" /> <label for="chkPlayed">Start Collapsed</label><br />
</div>
<br />
<div id="selectPageSizeBox" style="display: none;">
@ -397,7 +398,7 @@
<option value="200">200</option>
<option value="300">300</option>
<option value="500">500</option>
<option value="10000">10000</option>
<option value="-1">All</option>
</select>
<br />
<br />
@ -441,10 +442,10 @@
<label for="chkDislikes">Dislikes</label><br />
<input class="chkIsFavorite" type="checkbox" name="chkFavorite" id="chkIsFavorite" data-filter="IsFavorite">
<label for="chkDislikes">Favorite</label><br />
<label for="chkIsFavorite">Favorite</label><br />
<input class="chkIsNotFavorite" type="checkbox" name="chkNotFavorite" id="chkIsNotFavorite" data-filter="IsNotFavorite">
<label for="chkDislikes">Not Favorite</label><br />
<label for="chkIsNotFavorite">Not Favorite</label><br />
</div>

View File

@ -543,7 +543,7 @@
DisplayType: "Screen",
};
function getTable(result) {
function getTable(result, initial_state) {
var html = '';
//Report table
html += '<table id="tblReport" data-role="table" data-mode="reflow" class="tblLibraryReport stripedTable ui-responsive table-stroke detailTable" style="display:table;">';
@ -585,17 +585,27 @@
});
}
else {
var row_count = 0;
var current_state = "table-row";
var current_pointer = "&#x25BC;";
if (initial_state == true) {
current_state = "none";
current_pointer = "&#x25B6;";
}
result.Groups.map(function (group) {
html += '<tr style="background-color: rgb(51, 51, 51);">';
html += '<th class="detailTableHeaderCell" scope="rowgroup" colspan="' + result.Headers.length + '">' + (group.Name || '&nbsp;') + '</th>';
html += '<tr style="background-color: rgb(51, 51, 51); color: rgba(255,255,255,.87);">';
html += '<th class="detailTableHeaderCell" scope="rowgroup" colspan="' + result.Headers.length + '">';
html += '<a class="lnkShowHideRows" data-group_id="' + row_count + '" data-group_state="' + current_state + '" style="cursor: pointer;">' + current_pointer + '</a> ';
html += (group.Name || '&nbsp;') + ' : ' + group.Rows.length;
html += '</th>';
html += '</tr>';
group.Rows.map(function (row) {
html += getRow(result.Headers, row);
html += getRow(result.Headers, row, row_count, current_state);
});
html += '<tr>';
html += '<th class="detailTableHeaderCell" scope="rowgroup" colspan="' + result.Headers.length + '">' + '&nbsp;' + '</th>';
html += '<th class="detailTableHeaderCell row_id_' + row_count + '" scope="rowgroup" colspan="' + result.Headers.length + '" style="display:' + current_state + ';">&nbsp;</th>';
html += '</tr>';
row_count++;
});
}
@ -604,9 +614,9 @@
return html;
}
function getRow(rHeaders, rRow) {
function getRow(rHeaders, rRow, row_count, current_state) {
var html = '';
html += '<tr class="detailTableBodyRow detailTableBodyRow-shaded">';
html += '<tr class="detailTableBodyRow detailTableBodyRow-shaded row_id_' + row_count + '" style="display:' + current_state + ';">';
for (var j = 0; j < rHeaders.length; j++) {
var rHeader = rHeaders[j];
@ -784,9 +794,13 @@
$('#tabFilter', page).hide();
}
var limit_per_page = query.Limit;
if (query.Limit == -1) {
limit_per_page = result.TotalRecordCount;
}
var pagingHtml = libraryBrowser.getQueryPagingHtml({
startIndex: query.StartIndex,
limit: query.Limit,
limit: limit_per_page,
totalRecordCount: result.TotalRecordCount,
updatePageSizeSetting: false,
viewButton: true,
@ -820,10 +834,28 @@
$('#selectReportGroupingBox', page).show();
$('#grpReportsColumns', page).show();
html += getTable(result);
var initial_state = $('#chkStartCollapsed', page).prop('checked');
html += getTable(result, initial_state);
$('.reporContainer', page).html(html).trigger('create');
$('.lnkShowHideRows', page).on('click', function () {
var row_id = this.getAttribute('data-group_id');
var row_id_index = 'row_id_' + row_id;
var row_group_state = this.getAttribute("data-group_state");
//alert(this.getAttribute("data-group_state"));
if (row_group_state == "table-row") {
this.setAttribute("data-group_state", "none");
$('.' + row_id_index, page).css("display", "none");
this.innerHTML = "&#x25B6;";
}
else {
this.setAttribute("data-group_state", "table-row");
$('.' + row_id_index, page).css("display", "table-row");
this.innerHTML = "&#x25BC;";
}
});
$('.lnkColumnSort', page).on('click', function () {
var order = this.getAttribute('data-sortfield');
@ -1259,6 +1291,10 @@
reloadItems(page);
});
$('#chkStartCollapsed', page).on('change', function () {
reloadItems(page);
});
$('#btnReportExportCsv', page).on('click', function (e) {
query.ExportType = "CSV";