소스 검색

Add event handler example to documentation on how to programmatically access a selection data.

Stan Senotrusov 9 년 전
부모
커밋
bae34d4f8a
1개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  1. 10 0
      docs/_includes/options/data/selection-access.html

+ 10 - 0
docs/_includes/options/data/selection-access.html

@@ -35,6 +35,16 @@ $('select').select2({
 
 // Retrieve custom attribute value of the first selected element
 $('select').find(':selected').attr('data-custom-attribute')
+{% endhighlight %}
+
+  <p>
+    In addition, properties/values from source data objects can ba accessed from within event handler:
+  </p>
+
+{% highlight js linenos %}
+$('select').on('select2:select', function (event) {
+  console.log(event.params.data)
+});
 {% endhighlight %}
 
 </section>