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
1390
Row index using igGrid with templating
posted

Hi, I’m trying to display the row index inside a grid column, but I’m unable to execute a calculation based on the index like:

<td>${parseInt($i) + 1}</td>

 

The calculation is not executed and rendered as:  ${parseInt(0) + 1}

Does the templating engine support inline calculations / functions?

If I only use the $i directive each row’s index comes out as 0, and is not incremented?

Thanks in advanced.

Christoff

 

Parents
  • 5105
    Suggested Answer
    Offline posted

    Hi Christoff,

    The templating engine does not do any javascript evaluation inside the template body. This was done for performance purposes and the only javascript evaluation is actually performed inside block directives for the templates.

    In addition to that the $i would not work properly in the context of a grid, as the grid is a bit sophisticated in the utilization of the templates, so I would suggest against using it, as it would simply not evaluate correctly for you.

    You can use the row selectors feature in order to get row numbering starting at 1 (this is part of the row selectors feature).

    I hope this solution works for you!

Reply Children