Skip to content

Commit

Permalink
fix search on related foundsets
Browse files Browse the repository at this point in the history
  • Loading branch information
paronne committed Dec 18, 2019
1 parent 75a96be commit 06f8d2a
Showing 1 changed file with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions svyPopupFilter/svyToolbarFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var FILTER_TYPES = {
NUMBER: 'numberPopupFilterTemplate',
TOKEN: 'tokenPopupFilterTemplate',
SELECT: 'selectFilterTemplate'
}
};

/**
* @type {String}
Expand Down Expand Up @@ -293,8 +293,6 @@ function AbstractToolbarFilterUX(uiComponent, tableComponent) {
// create filter
}



/**
* Filter Toolbar implementation using the listcomponent from the custom-rendered-components package.
* This implementation requires a "List Component" element and an "Data-Grid" element.
Expand Down Expand Up @@ -1104,11 +1102,39 @@ function initSvyGridFilters() {
* */
SvyGridFilters.prototype.getDefaultSearch = function() {

if (!this.getTable()) {
return null;
}



var columns = this.getTable().columns;
var tableFoundset = this.getTable().myFoundset.foundset;
var tableDataSource;
if (tableFoundset) {
tableDataSource = tableFoundset.getDataSource()
var tableDataSource;

var jsForm = solutionModel.getForm(this.getTable().getFormName());
var jsTable = jsForm.findWebComponent(this.getTable().getName());
var foundsetSelector = jsTable.getJSONProperty("myFoundset").foundsetSelector;

try {
if (foundsetSelector) {
if (databaseManager.getTable(foundsetSelector)) {
tableDataSource = foundsetSelector;
} else if (foundsetSelector.split('.').length > 1) {
tableDataSource = scopes.svyDataUtils.getRelationForeignDataSource(foundsetSelector)
} else if (solutionModel.getRelation(foundsetSelector)) {
var jsRel = solutionModel.getRelation(foundsetSelector);
tableDataSource = jsRel.foreignDataSource;
}
}
} catch (e) {
application.output(e, LOGGINGLEVEL.ERROR);
}

if (tableDataSource) {
// do nothing
} else if (tableFoundset) {
tableDataSource = tableFoundset.getDataSource();
} else {
var form = forms[this.formName];
tableDataSource = form ? form.foundset.getDataSource() : null;
Expand Down

0 comments on commit 06f8d2a

Please sign in to comment.