-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #223 from UUDigitalHumanitieslab/feature/filters
Add basic filters to search view
- Loading branch information
Showing
8 changed files
with
122 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
<h4 id="search-feedback"></h4> | ||
<ul class="inline-list"> | ||
<li><a href="#" class="more-records">Load more records</a></li> | ||
<li><a href="#" class="more-records">Load 50 more records</a></li> | ||
<li><a href="#" class="500-more-records">Load 500 more records</a></li> | ||
<li><a href="#" class="download-xlsx">Download XLSX</a></li> | ||
<li><a href="#" class="download-csv">Download CSV</a></li> | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* A Tabulator menu to hide and show the available columns. | ||
* Adapted from: https://tabulator.info/examples/6.2#menu | ||
*/ | ||
export const columnChooseMenu = function(){ | ||
const menu = []; | ||
const columns = this.getColumns(); | ||
menu.push({ | ||
label: "Show/hide columns", | ||
disabled: true, | ||
}, { | ||
separator: true, | ||
}); | ||
|
||
for (let column of columns) { | ||
const definition = column.getDefinition(); | ||
if (definition.field === "model" || !definition.title) { | ||
/* Do not add the 'model' column (for internal use only) and | ||
do not add columns that do not have a title */ | ||
continue; | ||
} | ||
// create checkbox element using font awesome icons | ||
const icon = document.createElement("i"); | ||
icon.classList.add("glyphicon"); | ||
icon.classList.add(column.isVisible() ? "glyphicon-check" : "glyphicon-unchecked"); | ||
|
||
// build label | ||
let label = document.createElement("span"); | ||
let title = document.createElement("span"); | ||
|
||
title.textContent = " " + definition.title; | ||
|
||
label.appendChild(icon); | ||
label.appendChild(title); | ||
|
||
// create menu item | ||
menu.push({ | ||
label: label, | ||
action: function(e){ | ||
// prevent menu closing | ||
e.stopPropagation(); | ||
|
||
// toggle current column visibility | ||
column.toggle(); | ||
|
||
// change menu item icon | ||
if (column.isVisible()) { | ||
icon.classList.remove("glyphicon-unchecked"); | ||
icon.classList.add("glyphicon-check"); | ||
} else { | ||
icon.classList.remove("glyphicon-check"); | ||
icon.classList.add("glyphicon-unchecked"); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
return menu; | ||
}; |