Sign in to follow this  
jksry

multiple parameters in Javascript function

Recommended Posts

Hi,

 

In Set label using link attribute i am calling a javascript function like this "link='j-myFunction-"123","null","test". 

when i try to take the first parameter alone that is "123" i am getting whole value as single value like"123,null,test".

Am i doing anything wrong? please correct me.

 

Thanks in advance.

Share this post


Link to post
Share on other sites

Hi,

 

The Parameters of the function for using JavaScript links having J- prefix should not be enclosed within quotes. Also using this method, you can just pass one parameter from chart to your JavaScript. So, when you need to pass multiple parameters, combine them using a delimiter in XML (like ,)  and then in your JavaScript method split it again. 

 

Hence, it is not possible to obtain a single value like 123 directly. You will have to split the entire value that you receive in the JavaScript function. Please refer the code below:

<set .. link='j-myFunction-123,null,test' />


function myFunction(val)
{	
		var a=val.split(',');
		var firstVal=a[0];
		var secondVal=a[1];
		var thirdVal=a[2];
}

Hope this helps. :)

Edited by Haritha

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this