Skip to content

Docs for: Does Select2 include extra information in these events? - #4583

Closed
guettli wants to merge 1 commit into
select2:masterfrom
guettli:patch-1
Closed

Docs for: Does Select2 include extra information in these events?#4583
guettli wants to merge 1 commit into
select2:masterfrom
guettli:patch-1

Conversation

@guettli

@guettli guettli commented Sep 14, 2016

Copy link
Copy Markdown

This pull request includes a

  • Bug fix
  • New feature
  • Translation
  • Documentation

The following changes were made

Added docs for "Does Select2 include extra information in these events?"

Related: http://stackoverflow.com/questions/39333354/select2-how-to-add-extra-information-for-selected-item

{% highlight js linenos %}
$(function() {
$('#mywidget').on('select2:select', function(evt){
alert(evt.params.data.mydata);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this wouldn't necessarily be documenting the fact that you can send back additional data on the selected data object, but instead it would be documenting the fact that evt.params.data exists on select2:select. Select2 passes a bunch of data along with events through evt.params, and the end goal for this section was to document that.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am happy that I found evt.params.data. I would like to share this information and provided this pull request. Please alter my pull request, if you think it can be improved. How do you want this change to look like?

@guettli

guettli commented Dec 9, 2016

Copy link
Copy Markdown
Author

Hi Kevin.

This pull request is still open. If you don't want to use my proposal, then what do you suggest?

It took me some time to find this. It would be nice to fill the place holder in the docs.

@alexweissman

Copy link
Copy Markdown
Contributor

I have now added this to the new docs: https://select2.org/programmatic-control/events#event-data

@guettli
guettli deleted the patch-1 branch September 11, 2017 09:28
kevin-brown pushed a commit that referenced this pull request Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants