Skip to content

Commit

Permalink
adding filters to Locator component (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
aginsberg committed Aug 9, 2019
1 parent c7ec73a commit 1a34404
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
15 changes: 15 additions & 0 deletions src/ui/components/results/locatorcomponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default class LocatorComponent extends Component {

this._resultsConfig = config.resultsConfig || {};
this._mapConfig = config.mapConfig || {};
this._filtersConfig = config.filtersConfig || {};

/**
* Locator param: The template name to use for rendering with handlebars
Expand All @@ -32,6 +33,10 @@ export default class LocatorComponent extends Component {
onMount () {
this.initResults();
this.initMap();

if (Object.keys(this._filtersConfig).length > 0) {
this.initFilters();
}
}

/**
Expand All @@ -53,4 +58,14 @@ export default class LocatorComponent extends Component {
container: '.js-yxt-locatorMap'
}, this._mapConfig));
}

/**
* A helper method to mount the FilterBox component
*/
initFilters () {
this.componentManager.create('FilterBox', Object.assign({
parent: this,
container: '.js-yxt-locatorFilters'
}, this._filtersConfig));
}
}
2 changes: 1 addition & 1 deletion src/ui/sass/modules/_Locator.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
display: flex;

&-resultsWrapper
&-contentWrapper
{
width: 100%;

Expand Down
5 changes: 4 additions & 1 deletion src/ui/templates/results/locator.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<div class="yxt-Locator">
<div class="js-yxt-locatorResults yxt-Locator-resultsWrapper"></div>
<div class="yxt-Locator-contentWrapper">
<div class="js-yxt-locatorFilters yxt-Locator-filtersWrapper"></div>
<div class="js-yxt-locatorResults yxt-Locator-resultsWrapper"></div>
</div>
<div class="js-yxt-locatorMap yxt-Locator-mapWrapper"></div>
</div>

0 comments on commit 1a34404

Please sign in to comment.