Skip to content

Commit bae34d4

Browse files
senotrusovjpic
authored andcommitted
Add event handler example to documentation on how to programmatically access a selection data.
1 parent 576f937 commit bae34d4

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

docs/_includes/options/data/selection-access.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ <h2 id="selection-api-access">
3535

3636
// Retrieve custom attribute value of the first selected element
3737
$('select').find(':selected').attr('data-custom-attribute')
38+
{% endhighlight %}
39+
40+
<p>
41+
In addition, properties/values from source data objects can ba accessed from within event handler:
42+
</p>
43+
44+
{% highlight js linenos %}
45+
$('select').on('select2:select', function (event) {
46+
console.log(event.params.data)
47+
});
3848
{% endhighlight %}
3949

4050
</section>

0 commit comments

Comments
 (0)