This commit is contained in:
2020-02-21 21:12:41 +00:00
parent 4049fa747b
commit 1c2d9ad7cf

View File

@@ -1258,6 +1258,10 @@ function initDataObject(vm) {
if (o.uiFieldDataType == 9 && o.tempFilterValue == null) {
o.tempFilterValue = [];
}
//Add display text for filter item (same as in addFilterCondition)
var filterItem = { op: null, value: null, display: null };
ret.push(o);
}
@@ -1340,7 +1344,107 @@ function updateEditedListView(vm) {
//build an array of all enums then execute method
}
//////////////////////////////////////////////////////////
//
// Convert filter properties to localized / displayable
// used when making new filter and loading existing
//
function getDisplayForFilter(
vm,
uiFieldDataType,
filterOperator,
filterValue,
enumType
) {
var ret = "";
//DATE RELATIVE FILTER
if (uiFieldDataType === 1) {
if (filterValue != "*select*") {
var valueDisplay = window.$gz._.find(vm.pickLists.dateFilterTokens, {
id: item.tempFilterToken
}).name;
var opDisplay = filterItem.op;
return filterOperator + " " + valueDisplay;
}
}
//BLANKS FILTER
if (filterOperator == "=" && filterValue == "*NULL*") {
return window.$gz._.find(vm.pickLists.stringFilterOperators, {
id: "*NOVALUE*"
}).name;
}
// NONBLANKS FILTER
if (filterOperator == "!=" && filterValue == "*NULL*") {
return window.$gz._.find(vm.pickLists.stringFilterOperators, {
id: "*HASVALUE*"
}).name;
}
//VALUE FILTER
//Nothing more to do if there isn't both a value AND an operator at this point
if (filterOperator == null || filterValue != null) {
if (window.$gz.errorHandler.devMode()) {
throw "ay-data-list-view::getDisplayForFilter Value filter missing one ore more of Operator, Value";
}
return "";
}
var valueDisplay = "selected value";
switch (uiFieldDataType) {
case 1: //date localize
valueDisplay = window.$gz.locale.utcDateToShortDateAndTimeLocalized(
filterValue
);
break;
case 8: //currency localize
valueDisplay = window.$gz.locale.currencyLocalized(filterValue);
break;
case 7: //decimal localize
valueDisplay = window.$gz.locale.decimalLocalized(filterValue);
break;
case 6: //BOOL localize
//debugger;
var ltKey = filterValue ? "True" : "False";
valueDisplay = vm.lt(ltKey);
break;
case 10: //ENUM localize
valueDisplay = window.$gz.enums.get(item.enumType, filterValue);
break;
default:
valueDisplay = filterValue;
break;
}
var opDisplay = window.$gz._.find(vm.pickLists.stringFilterOperators, {
id: filterItem.op
}).name;
return opDisplay + ' "' + valueDisplay + '"';
//eoc
}
/*
public const string OpEquality = "=";
public const string OpGreaterThan = ">";
public const string OpGreaterThanOrEqualTo = ">=";