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

recover DropDownList name or pass additional parameters on clientEvents

Hi.

I have a dropdownList

@Html.EJ().DropDownList("containersList").Datasource((IEnumerable<DocTracerPortal.Models.Visual.VisualContainer>)ViewBag.containersSource).DropDownListFields(f => f.Value("parentId").Text("text")).CascadeTo("areasList,documentCategoriesList,documentCategoriesList,documentStatusList,documentActionList").EnableRTL(true).ClientSideEvents(e => e.Change("onItemContainerChange"))

I want to recover the dd id on the Event 

function onItemContainerChange(args)
{
 var currentTarget = args.currentElement;
var parentID = $(currentTarget)[0].id;
}

I used that kind of call to get the values from a treeview. I will have that event connected to multiple instances. 
But, I cannot find the way to pass a parameter in the event call, for instance ClientSideEvents(e => e.Change("onItemContainerChange(verify)"))

And if I try to check args, args return the model value of the dropdownlist but it does not contain the object parent reference that triggers the event initially. 

args
Object {
text: "ACT/NSW", selectedText: "ACT/NSW", itemId: 0, selectedValue: 1, value: 1…
}
cancel: falseisChecked: true
isInteraction: true
itemId: 0
model: Object
selectedText: "ACT/NSW"
selectedValue: 1
text: "ACT/NSW"
type: "change"
value: 1__proto__: Object

There is any way to do this. 



1 Reply

KC Kasithangam C Syncfusion Team August 19, 2016 11:42 AM UTC

Hi Juan,   
Thanks for contacting Syncfusion support.   
Query 1: I want to recover the dd id on the Event. I used that kind of call to get the values from a treeview. I will have that event connected to multiple instances.    
 We can get the current control id in the change event by using the “this.element[0].id” as shown below code:   
 
<code> 
 
function onItemContainerChange(args) { 
      var currentTarget = this.element[0].id; 
    } 
</code> 
 
 In this, you can get the current target element id of the desired component. Also, the corresponding component selected value in the args.model. For example, if you need to get the Dropdownlist selected value in change event, then you can get the value by using the args.model.value.   
 
We have prepared the sample based on this and it is available under the following link: 
 
Sample: Sample 
 
Also, we need to clarify that whether the given sample meets your requirement or we misunderstood, if so please provide more details about the requirement and it will be easy for us to provide the exact solution.    
 
Query 2: I cannot find the way to pass a parameter in the event call, for instance ClientSideEvents(e => e.Change("onItemContainerChange(verify)")).And if I try to check args, args return the model value of the dropdownlist but it does not contain the object parent reference that triggers the event initially.  
 
We have created new incident for this query. A support incident to track the status of this issue has been created under your account. Please log on to our support website to check for further updates.   
  
Regards, 
Kasithangam 


Loader.
Up arrow icon