Skip to content

Commit 65bef1a

Browse files
committed
Add new configuration options for Search widget.
- Set the default tab - Array of tabs that are hidden
1 parent 1453c6e commit 65bef1a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

widgets/Search.js

+25
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ define([
7373
attributeLayer: 0,
7474
drawToolbar: null,
7575

76+
// to override the default tab when the widget starts
77+
defaultTab: 0,
78+
79+
/*
80+
To hide specific tabs.
81+
This is an zero-based array so [1] would hide the second tab.
82+
It is an array to anticipate more than 2 tabs in a future release.
83+
/*
84+
hiddenTabs: [],
85+
7686
drawingOptions: {
7787
rectangle: true,
7888
circle: true,
@@ -144,6 +154,21 @@ define([
144154
aspect.after(this, 'resize', lang.hitch(this, function () {
145155
this.tabContainer.resize();
146156
}));
157+
158+
this.tabChildren = this.tabContainer.getChildren();
159+
if (this.defaultTab !== null) {
160+
var defTab = this.tabChildren[this.defaultTab];
161+
if (defTab) {
162+
this.tabContainer.selectChild(defTab);
163+
}
164+
}
165+
166+
var k = 0, len = this.hiddenTabs.length;
167+
for (k = 0; k < len; k++) {
168+
var tab = this.tabChildren[this.hiddenTabs[k]];
169+
domStyle.set(tab.domNode, 'display', 'none');
170+
domStyle.set(tab.controlButton.domNode, 'display', 'none');
171+
}
147172
},
148173
149174
addTopics: function () {

0 commit comments

Comments
 (0)