Document Properties Marker |
---|
|
Short Description | In this example a display table macro is used and filtered using a transclusion and the remote controlled feature. |
|
---|
Doctype | topic | hide |
---|
Name | Display Table Example Using Filters |
|
---|
Short Name | |
|
---|
Parent | | hide |
---|
Audience | Name List |
---|
doctype | role |
---|
render-no-hits-as-blank | true |
---|
property | Audience |
---|
empty-as-none | true |
---|
|
|
|
---|
Subject | Name List |
---|
doctype | subject |
---|
property | Subject |
---|
|
|
|
---|
Categories | Name List |
---|
doctype | category |
---|
property | Categories |
---|
|
|
|
---|
Tags | |
|
---|
Flags | | hide |
---|
Iteration | |
|
---|
Type | Name List |
---|
doctype | topic-type |
---|
render-no-hits-as-blank | true |
---|
property | Type |
---|
|
|
|
---|
Level of Experience | Name List |
---|
doctype | experience-level |
---|
render-no-hits-as-blank | true |
---|
property | Level of Experience |
---|
|
|
|
---|
Expected Duration | |
|
---|
Sponsors | Name List |
---|
doctype | stakeholder |
---|
render-no-hits-as-blank | true |
---|
property | Sponsors |
---|
|
|
|
---|
Sort Key | | hide |
---|
|
Section |
---|
|
Using the Display Table Macro by setting the Identifier to filtered in conjunction with the Transclusion Macros Replacement feature and the Remote Control (Feature) for filtering. Section |
---|
| At first you can try it here yourself: Transclusion |
---|
document | Filter Module |
---|
ids | HTML-CODE |
---|
| |
Display Table |
---|
doctype | generic |
---|
select | Name, Short Description, Iteration |
---|
render-id | filtered |
---|
where | $<DirectAncestorId>=[112494396] |
---|
|
Transclusion |
---|
document | Filter Module |
---|
ids | HTML-CODE |
---|
| |
Display Table |
---|
doctype | generic |
---|
select | Name, Short Description, Iteration |
---|
render-id | other |
---|
where | $<DirectAncestorId>=[112494396] |
---|
|
|
Section |
---|
title | Configure a Filter Yourself |
---|
| Now you can follow the steps and use a filter for your own: Steps |
---|
Section |
---|
title | Setting up the Display Table Macro |
---|
| Choose a doctype, select and where statement.
Set the Identifier to filtered.
|
Section |
---|
title | Transclude the Filter Code |
---|
| Use the transclusion macro to transclude the HTML code for filtering (get the code) .
Add as replacement the initial where condition of the display table macro and provide the options: initialwhere=$<DirectAncestorId>=[112494396]
datalistselects=<datalist id="selects"><option value="Name">Name only</option><option value="Name, Short Description, Iteration">With Iteration</option></datalist>
datalistwhere=<datalist id="wheres"><option value="$<Iteration>=[Facade]">Facade</option><option value="$<Iteration>=[Filled]">Filled</option><option value="$<Iteration>=[Finished]">Finished</option></datalist>
As alternative empty options can be used if the dropdown functionality is not needed: initialwhere=$<DirectAncestorId>=[112494396] datalistselects=<datalist id="selects"></datalist> datalistwhere=<datalist id="wheres"></datalist> |
|
|
|
Section |
---|
|
Display Table |
---|
doctype | topic |
---|
render-no-hits-as-blank | true |
---|
render-mode | definition |
---|
select | Name, Short Description |
---|
restrict-to-immediate-children | true |
---|
sort-by | Sort Key, Name |
---|
|
|
Section |
---|
required-permissions | write-access |
---|
title | Notes |
---|
|
|
Section |
---|
|
Tour |
---|
render-no-hits-as-blank | true |
---|
render-as-definition-list | true |
---|
marker-column-property-name | Title |
---|
replace-title-with-name | true |
---|
| |
|
Section |
---|
|
Tour |
---|
render-no-hits-as-blank | true |
---|
render-as-definition-list | true |
---|
marker-column-property-name | Title |
---|
replace-title-with-name | true |
---|
| |
|
<form id="filterForm${uniqueid}" action="">
select:
<input id="filterSelect${uniqueid}" size="50" type="text" list="selects${uniqueid}" name="select" >
${datalistselects}
where:
<input id="filterWhere${uniqueid}" size="50" type="text" list="wheres${uniqueid}" name="where">
${datalistwhere}
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>
<script>
AJS.toInit(function() {
var urlParams = new URLSearchParams(window.location.search);
var originalSelect = urlParams.get('${tableid}:select');
var originalWhere = urlParams.get('${tableid}customWhere');
$("#filterSelect${uniqueid}").val(originalSelect);
$("#filterWhere${uniqueid}").val(originalWhere);
function appendToQueryString( queryString, queryParam ) {
if(queryString.trim())
{
queryString=queryString + "&" + queryParam;
}
else
{
queryString="?"+queryParam;
}
return queryString;
};
$('#filterForm${uniqueid}').submit(function(evt) {
evt.preventDefault();
var tableId = "${tableid}";
var $initialWhere = "${initialwhere}"
var $select = $('#filterSelect${uniqueid}').val();
var $where = $('#filterWhere${uniqueid}').val();
console.debug($select);
console.debug($where);
var $queryString="";
if ($select.trim())
{
var $encodedSelect = encodeURI($select);
var $selectQueryParam = tableId + ":"+"select"+"="+$encodedSelect;
$queryString=appendToQueryString($queryString, $selectQueryParam);
}
if ($where.trim())
{
var $encodedCustomWhere = encodeURI($where);
var $customWhereQueryParam = "${tableid}customWhere"+"="+$encodedCustomWhere;
var $encodedWhere = encodeURI($initialWhere + " AND " + $where);
var $whereQueryParam = tableId + ":"+"where"+"="+$encodedWhere;
$queryString = appendToQueryString($queryString, $whereQueryParam);
$queryString = appendToQueryString($queryString, $customWhereQueryParam );
}
$action = window.location.href.split('?')[0] + $queryString;
$('#filterForm').attr('action', $action);
console.debug($action);
window.location.href=$action;
});
});
</script>