We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

conditionnal templating

Hi,

I try to make a template with condition into a treeview but it does'nt work.

I have au json file like this : 

    [{"id":1,"project_id":1,"nodable_id":null,"nodable_type":null,"node_infos_id":1,"_lft":1,"_rgt":8,"parent_id":null,"deleted_at":null,"created_at":"2019-04-18 08:59:50","updated_at":"2019-04-18 09:17:49","reference":"racine","libelle":"racine","children":[{"id":2,"project_id":1,"nodable_id":null,"nodable_type":null,"node_infos_id":2,"_lft":2,"_rgt":5,"parent_id":1,"deleted_at":null,"created_at":"2019-04-18 09:00:14","updated_at":"2019-04-18 09:17:49","reference":"niveau 1","libelle":"niveau 1","children":[{"id":4,"project_id":1,"nodable_id":15,"nodable_type":"Simfred\\Models\\Tag","node_infos_id":4,"_lft":3,"_rgt":4,"parent_id":2,"deleted_at":null,"created_at":"2019-04-18 09:01:06","updated_at":"2019-04-18 09:17:49","reference":"tag 1","libelle":"tag 1","children":[]}]},{"id":3,"project_id":1,"nodable_id":null,"nodable_type":null,"node_infos_id":3,"_lft":6,"_rgt":7,"parent_id":1,"deleted_at":null,"created_at":"2019-04-18 09:00:34","updated_at":"2019-04-18 09:17:49","reference":"niveau 1b","libelle":"1b","children":[]}]},{"id":5,"project_id":1,"nodable_id":null,"nodable_type":null,"node_infos_id":5,"_lft":9,"_rgt":10,"parent_id":null,"deleted_at":null,"created_at":"2019-04-18 09:01:32","updated_at":"2019-04-18 09:01:32","reference":"racine 2","libelle":"racine 2","children":[]},{"id":6,"project_id":1,"nodable_id":256,"nodable_type":"Simfred\\Models\\Tag","node_infos_id":6,"_lft":11,"_rgt":12,"parent_id":null,"deleted_at":null,"created_at":"2019-04-18 11:18:12","updated_at":"2019-04-18 11:18:12","reference":"ggg","libelle":"ggg","children":[]}]
Into the template I would like to make a contition to nodable_type I wrote this code :
<script id="treeTemplate" type="text/x-template">
<div>
${if(nodable_type=='Simonfred\Models\Tag')}
<span>tag</span>
${else}
<span>rep</span>
${/if}
<div class="">${libelle}-${reference}</div>
</div>
</script>
I missed something ?

Thanks 


1 Reply

KS Kumaresan Subramani Syncfusion Team April 22, 2019 10:48 AM UTC

HI Emmanuel Simon, 
 
We can able to reproduce your reported issue. We need to validate this in some other cases. We will update you with in one business day. 
 
Please let us know if you have any concern. 
 
Regards, 
Kumaresan S 


Loader.
Live Chat Icon For mobile
Up arrow icon