Skip to content

Commit 1efdc92

Browse files
Merge pull request #401 from DevExpress/callback_doc
Add docs for callback method
2 parents 26751b2 + bf40d0a commit 1efdc92

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

README.md

Lines changed: 29 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 functions](#callback-functions)
1617
* [One-way option binding](#one-way-binding)
1718
* [Two-way option binding](#two-way-binding)
1819
* [Custom templates](#custom-templates)
@@ -163,6 +164,34 @@ 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-functions"></a>Callback Functions ###
168+
169+
To specify a widget's option using a callback function (the [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+
Note that callback functions are executed _outside_ the context of the component, but if the context is important, you can explicitly bind it to the callback function in the constructor.
183+
184+
```js
185+
constructor() {
186+
this.customizeLayers = this.customizeLayers.bind(this);
187+
}
188+
189+
customizeLayers(elements) {
190+
let country = this.myCountry;
191+
...
192+
}
193+
```
194+
166195
### <a name="one-way-binding"></a>One-way Option Binding ###
167196

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

0 commit comments

Comments
 (0)