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
85
Multiple conditional cell templates
posted

I'm using the latest version of Ignite (Ignite UI 2013 Vol. 2) binding to a JSON data array obtained by a separate AJAX function and for the most part all the data is being rendered correctly.  However, I'm trying to inject a label "<span class='label label-danger'>Markers</span>" if ${markers} column doesn't equal null.  Again this works as intended, however, I need to add multiple labels based are other column values.  

I now no multiple conditional statements aren't supported.  I've tried to inject a function call into the actual data column and via a column template but these are rendered as data by the grid. I'm now at a loss as to how to approach this problem therefore, any assistance would be greatly appreciated. 

If I rendered the HTML as a table and then bind would that work? 

Parents
  • 2745
    Verified Answer
    Offline posted

    Multiple conditional statements are supported but they become very verbose.

    Unsupported:

    if (condition1) {

    }

    if (condition2) {

    }

    Supported:

    if (condition1) {

    } elseif (condition2) {

    } else {

    }

    {{if ${key} == null}} template 1 {{elseif ${key} == true}} template 2 {{else}} template 3 {{/if}}

    If the value you trying to inject doesn't need to support updates, then you could also use an unbound column and call a formula to construct the template for you.

Reply Children
No Data