<form id="filterForm${tableid}" action="">
<label for="select">select:</label>
<input id="filterSelect${tableid}" size="50" type="text" list="selects${tableid}" name="select" autocomplete="on">
${datalistselects}
<label for="where">where:</label>
<input id=" filterWherefilterWhere${tableid}" size="50" type="text" list=" whereswheres${tableid}" name="where" autocomplete="on">
${ datalistwheredatalistwheres}
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>
<script>
AJS.toInit(
function() {
var const urlParamslogToConsole = new URLSearchParams(window.location.search)false;
var originalSelectif =(logToConsole) urlParamsAJS. get('filtered:select');
var originalWhere = urlParams.get('customWhere'log("[copy-page-id] Registering action 'Copy Page ID to Clipboard' to keydown 'p'...");
$("#filterSelect").val(originalSelect); console.debug('${datalistselects}')
$("#filterWhere").val(originalWhere);
function appendToQueryString( queryString, queryParam ) {
if (queryString.trim()) {
{
queryString = queryString + "&" + queryParam;
}
else {
else
{
queryString = "?" + queryParam;
}
return queryString;
};
$('#filterForm').submit(function(evt) {
evt.preventDefault();
var tableIdurlParams = "filtered" new URLSearchParams(window.location.search);
var $initialWhereoriginalSelect = "urlParams.get('${ initialwhere}"
tableid}:select');
var $selectoriginalWhere = $urlParams.get(' #filterSelect').val(${tableid}customWhere');
var $whereinitialWhere = $urlParams.get(' #filterWhere').val(${tableid}initialWhere');
console.debug( $select);
console.debug($where"From Queryparam : initial where is: " + initialWhere);
var oldQueryParams $queryString= "" ;
urlParams.forEach(function(value, key) {
if ( $select!key. trim(startsWith("${tableid}")) {
{
var $encodedSelect = encodeURI($select);
var $selectQueryParamoldQueryParams = appendToQueryString(oldQueryParams, tableIdkey + ":"+" select"+"=" +$encodedSelect + encodeURI(value));
$queryString=appendToQueryString($queryString, $selectQueryParam);
}
});
if ( $where.trim())
{
var $encodedCustomWhere = encodeURI($where);
typeof initialWhere == 'undefined' || initialWhere == null) {
console.debug("Check 1 a: initial where is empty");
var $customWhereQueryParam if (initialWhere = "customWhere"+"="+$encodedCustomWhere;
= originalWhere) {
var $encodedWhere = encodeURI($initialWhere + " ANDconsole.debug("In Check 1 b : initial where is: " + $whereinitialWhere);
var $whereQueryParam = tableId + console.debug(" :"+"where"+"="+$encodedWhereIn Check 1 b : original where is: " + originalWhere);
$queryString } else {
initialWhere = appendToQueryString($queryString, $whereQueryParam);
$('#${tableid} table').attr('data-projectdoc-query-where');
$queryString = appendToQueryString($queryString, $customWhereQueryParam );
}
$action = window.location.href.split('?')[0] + $queryString;
$('#filterForm').attr('action', $action);
console.debug($actionconsole.debug("In Check 1 c: initial where is: " + initialWhere);
console.debug("In Check 1 c : original where is: " + originalWhere);
}
if (typeof initialWhere == 'undefined' || initialWhere == null) {
console.debug("Check 1 : initial is set to empty string.");
initialWhere = null;
console.debug("In Check 1/1 : initial where is: " + initialWhere);
window.location.href=$action;
});
});
</script> Section |
---|
|