Skip to content

Infragistics Community Forum / Web / Ignite UI for jQuery / Syntax error passing a GUID as string to a javascript function off a column template

Syntax error passing a GUID as string to a javascript function off a column template

New Discussion
bryan dunn
bryan dunn asked on Jun 6, 2014 8:29 PM

I'm trying to format a column to reference a JavaScript function with a GUID value pulled from the database, but I get a syntax error when debugging in IE (the function doesn't fire in Firefox or Chrome either).

<a onclick='Jump(${CPSGUID});'>${Person}</a>

I assume it's due to the hyphens in the guid, but is there a way to ensure the varlable CPSGUID gets passed as a string to the function?

Sign In to post a reply

Replies

  • 0
    [Infragistics] Michael H.
    [Infragistics] Michael H. answered on Jun 6, 2014 8:24 PM

    Hello bryan dunn,

     

    Thanks for posting in our forums!

    It looks like the issue is that the CPSGUID value is being directly rendered as the string value.

    This means the rendered tag looks like this: <a onclick='Jump(ABCD-1234-EFGH);'>Bob</a> which is assuming you have a variable named ABCD-1234-EFGH somewhere.

    If you use something like the following for the template, it should work fine:

     template: "<a onclick='Jump(\"${CPSGUID}\");'>${Person}</a>" 

    Please note you may have to escape the quotes as I have so they appear correctly.  This should render the tag like the following and pass the value as a string:

     <a onclick='Jump("ABCD-1234-EFGH");'>Bob</a> 

    If you have any further questions or concerns with this, please let me know.

    • 0
      bryan dunn
      bryan dunn answered on Jun 6, 2014 8:29 PM

      Perfect. Thanks, Michael.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
bryan dunn
Favorites
0
Replies
2
Created On
Jun 06, 2014
Last Post
11 years, 8 months ago

Suggested Discussions

Tags

Created by

Created on

Jun 6, 2014 8:29 PM

Last activity on

Feb 16, 2026 9:35 PM