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?
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.
Our implementation doesn't require any details to be updated and therefore, the unbound column formula solution proved successful is this instance. Although, the word 'formula' is a little misleading in that one expects a numerical return value but it can actually return any valid column data type.
The solution however, does come with some unexpected side-effects. Because filtering is turned on tag text is also included in the filter search. for example in our case the markup "<span class='label label-danger'>Markers</span>" allows filtering on the tag markup and not just the text within the tag. I understand why this is happening but the end user may find it a little misleading.
I have noticed a couple of other issues whilst testing such as when selecting a predefined filter on a bound date column the filter functionality is disabled and therefore, users are unable to clear the filter and the only way restore it back to it's default is to refresh the page. Also the column chooser doesn't 'show' hidden columns. This may or may not be something to do with the bootstrap framework. However, I will create separate threads for both of these after I have performed more testing.
Thank-you for the prompt and accurate information.