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

change value drop down

Hi, good afternoon, me again haha, sorry for continuing asking, but now come here for a problem that i couldn't get any solution, i have the next custom field 

that when an user change value of a 'Tratamiento', call the method onDropDownChange(), the problema is that the arguments that receive this method is 

its useful but not at all, because if i print (console.log(args)) i get what show before, but if i want the value of an variable from the component (for example the customers) or if a what to do and http method i get undefined. 

what i get 


this.clientes is an array that have the 'customers' (i get it by http onInit() method)


this restrict me do many actions, like change value of variables, etc.

So my question is , is there any form to try get it? for example that i have and field (drop down) that shows me costumers, so if a choose one, i want to call a http method (or at least can get value of my variables) to get his 'treatments' . Thank you very much for all answers :)


1 Reply

UD UdhayaKumar Duraisamy Syncfusion Team November 16, 2022 07:27 AM

You can get the selected item data in the arguments of the change event. Please refer to the below code snippet and sample for more details.


[Code Snippet]

let sportsData: { [keystring]: Object }[] = [

  { Id: 'game1'Game: 'Badminton' },

  { Id: 'game2'Game: 'Football' },

  { Id: 'game3'Game: 'Tennis' },

];

let listObjDropDownList = new DropDownList({

  placeholder: 'Select a game',

  dataSource: sportsData,

  fields: { text: 'Game'value: 'Id' },

  floatLabelType: 'Always',

  change: function (args) {

    console.log('Selected Game Name : ' + args.itemData.Game);

    console.log('Selected Game Id : ' + args.itemData.Id);

  }

});

listObj.appendTo('#games');


[Reference]

 



Loader.
Live Chat Icon For mobile
Up arrow icon