We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Pass Custom Data to Change Event Method

Hi,

I need to pass some additional custom data when the Change event is triggered. So far I am unable to get this working.

Example:

<ejs-dropdownlist
  :dataSource='dataSource'
  placeholder='Select data'
  :change='onChange($event, data)'>
</ejs-dropdownlist>


onChange(event, data) {
  console.log(event);
  console.log(data);
}


How can I accomplish this? Thank you!


3 Replies

SP Sureshkumar P Syncfusion Team February 28, 2023 11:52 AM UTC

Hi Camille,

You can achieve your requirement by using the below code example.

Find the code example here:

<ejs-dropdownlist

          id="multiselect"

          :dataSource="data"

          placeholder="Find a game"

          :fields="fields"

          :change="onFiltering.bind(e, 'args')"

        ></ejs-dropdownlist>

 

 onFiltering: function (e, args) {

      debugger;

    },

 


Find the screenshot here:


Find the sample here: https://codesandbox.io/s/jolly-euclid-unw49x?file=/src/App.vue:0-1256

Regards,

Sureshkumar P



CS Camille Sevigny March 6, 2023 06:27 PM UTC

This works great, but I have a question. why do the variables switch? The value of the event "e" which is the first object in the method call is sent to the second parameter in the method "args" and vice versa?



SP Sureshkumar P Syncfusion Team March 8, 2023 04:12 AM UTC

Camille, when method handler calling with custom argument using explicit binding the argument interchanged. Which is the reason the argument exchanged this scenario.


Loader.
Up arrow icon