Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
405
Call Javascript function inside iggrid Template
posted

I want to call a JS function inside my iggrid Template method. The idea is that the JS function return the image path for a given issue state id. But the problem is, the JS function is never called. What do I wrong?

In the iggrid so I call the Template function:

column.For(p => p.IssueStateID).HeaderText("State*").Template("#Template_TaskState");
  
 

And the Template function looks so:
<script id="Template_TaskState" type="text/x-jquery-tmpl">
    <div style="float:left">
        <img width="10" height="15" src="getIssueStateImageById({{>IssueStateID}})" /> 
    div> script>

 

  • 15320
    Offline posted

    Hi Stanislas,

    I believe that the problem with never calling javascript function is not related to the fact that you're using igGrid template. Please note that the image 'src' attribute takes an URL, not a javascript function. If you want to avoid hardcoding of the image url and instead of this use a function to return it, then please try some of the suggestions in the following thread for your reference: http://stackoverflow.com/questions/12196435/javascript-function-return-src-path If I can provide you with further assistance, please let me know.

    Regards,
    Tsanna