Skip to content

Commit 6fd2fc7

Browse files
author
zhernovkova.anna
committed
Add docs for callback method
1 parent eef33f8 commit 6fd2fc7

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ This project allows you to use [DevExtreme Widgets](http://js.devexpress.com/Dem
1313
* [Static string option value](#static-option)
1414
* [Static non-string option value](#static-non-string-option)
1515
* [Event handling](#event-handling)
16+
* [Callback method](#callback-method)
1617
* [One-way option binding](#one-way-binding)
1718
* [Two-way option binding](#two-way-binding)
1819
* [Custom templates](#custom-templates)
@@ -163,6 +164,35 @@ To bind the dxButton’s [click](http://js.devexpress.com/Documentation/ApiRefer
163164
<dx-button (onClick)="handler()"></dx-button>
164165
```
165166

167+
### <a name="callback-method"></a>Callback method ###
168+
169+
To specify a callback method as widget's option ([layer.customize](https://js.devexpress.com/Documentation/16_2/ApiReference/Data_Visualization_Widgets/dxVectorMap/Configuration/layers/#customize)
170+
option of dxVectorMap).
171+
172+
```html
173+
<dx-vector-map>
174+
...
175+
<dxi-layer
176+
...
177+
[customize]="customizeLayers">
178+
</dxi-layer>
179+
</dx-vector-map>
180+
```
181+
182+
Be careful: the callback method will lost the context of the component, so if method use a context-dependent functionality we can
183+
bind the context to this method in a constructor explicitly.
184+
185+
```js
186+
constructor() {
187+
this.customizeLayers = this.customizeLayers.bind(this);
188+
}
189+
190+
customizeLayers(elements) {
191+
let country = this.myCountry;
192+
...
193+
}
194+
```
195+
166196
### <a name="one-way-binding"></a>One-way Option Binding ###
167197

168198
If we want changes to the value of ‘bindingProperty’ of the host component to propagate to the

0 commit comments

Comments
 (0)