Skip to main content

How to get a format template name that is used in a table cell

Comments

4 comments

  • Zendesk API User
    Author: felix_reinhold - 4/11/2019 10:38

    Hello Dragan,

    I don't know if I really undertood what you need, but can't you just do what you want to do by editing the table_icon Formattemplate?

    Just adjust the html channel of the template to generate an output of the table_icon.

    Best regards

    Felix

    0
  • Zendesk API User
    Author: draganr - 4/11/2019 12:01

    Hi Felix,

    No. So basically, I have something like this:

    And then, because I used that format template table_icon I need to add to the TD tag the following class: -is-icon

    I have found out the following this morning:

    $CMS_IF(#content.toString().indexOf("a-icon") > 0)$ -is-icon$CMS_END_IF$

    Is that a good approach? Or if there is another one?

    Regards,

    Dragan

    0
  • Zendesk API User
    Author: felix_reinhold - 4/11/2019 12:37

    Hi Dragan,

    I don't know if a good approach exists for this case.

    If I need get information from childnodes in a dom I do it like this:

    td-template:

    $CMS_SET(set_iconClass,"")$

    $CMS_SET(set_content)$

    $CMS_VALUE(#content)$

    $CMS_END_SET$

    $CMS_SET(set_content, set_content.toString())$

    <td$--

         --$$CMS_VALUE(if(set_iconClass != "", " class='" + set_iconClass + "'"))$$--

    --$>$--

         --$$CMS_VALUE(set_content)$$--

    --$</td>

    In template table_icon:

    $CMS_SET(set_iconClass,"is-icon")$

    $-- then your normal html-output for the icon: --$

    <span class="icon">ICON</span>

    Basically I'm prerendering the contents and I provide a variable that can be used by the child-nodes.

    Best regards

    Felix

    0
  • Zendesk API User
    Author: draganr - 4/11/2019 13:07

    Hi Felix,

    Thank you very much. That is very good.

    Best regards,

    Dragan

    0

Please sign in to leave a comment.