Hi,
I am trying to attach a number to the node of the tree based on the condition. So i am using a template to do the condition checking
private counttemplate: string = "{{if ${c} != \"0\" && ${c} != \"\"}}${title}<span style=\"font-weight:bold;color:#556B2F\">${c}</span>{{else}}${title}{{/if}}'";
seems like the igtree doesnt like this. but if i take of the condition checking and just do ${title}<span style=\"font-weight:bold;color:#556B2F\">${c}</span>
it works.
Please let me know how to make the templating work with igtree with angular 2 framework.
Hi Mike,
I tried the templating in angular app with igTree and it seems fine.
I used similar condition template and I'm sending my sample back to you.
Please review it and let me know if you need further assistance.
Hi i did try to download the sample project and do a npm install one it it seems like the ignite ui doesnt get pulled and if i do a npm install igniteui-angular2 to get the libarary its doesnt transpile it to js for me to use.
can you please review the project setting and send it back to me.
s
Hello,
Sounds like you have to include additional condition into the template of the second binding.
I was able to make the changes to the data to make it work but the problem i have is applying multiple templates to a single children under a parent node.To explain better
my data yeild tree somewhat like
ROOT
INBOX
Item
REPORT
A Report
a
b
so i am trying to template the title of the report such that is there is a v attributes set to N the title would be bold on the children level.
what i am seeing is if i apply the template i have put in the a, b gets bold but even if i do have a v attribute for the inbox level children the title doesn't get applied the template i have put in which is
bindings: {
childDataProperty: "children", textKey: "title", valueKey: "id", imageUrlKey: "iconURL", expandedKey: "Expanded", nodeContentTemplate: "{{if ${c} != 0 && ${c} != \'\' && ${c} != null}} ${title}<span style=\"font-weight:bold;color:#556B2F\"> (${c})</span>{{else}}${title}{{/if}}", bindings: { childDataProperty: "children", textKey: "title", valueKey: "id", imageUrlKey: "iconURL", expandedKey: "Expanded", nodeContentTemplate: "{{if ${c} != 0 && ${c} != \'\' && ${c} != null}} ${title}<span style=\"font-weight:bold;color:#556B2F\"> (${c})</span>{{else}}${title}{{/if}}", bindings: { childDataProperty: "children", textKey: "title", valueKey: "id", imageUrlKey: "iconURL", expandedKey: "Expanded", nodeContentTemplate: "{{if ${v} == \'N\'}}<a style=\"font-weight:bold\">${title}</a>{{else}}${title}{{/if}}" } } }
How do i go about applying template on the children level for the inbox without compromising whatever templating i have done so far.
I have attached a sample attached with this message.
You cannot have undefined arguments inside of the condition of the template, because they cannot be evaluated.
One way to solve it is to populate null values for those properties in each node.
Another approach is to check for something which is always defined. For example {{if ${title} == 'Root'}}
I tried to run it with my data structure looks like there is some issue with the tree not able to display when there is certain data value not included in the parent node.I have attached the sample project with data structure i am using. I wanted to know if there is a way to check if a data value exist within the template so that only the node with that value can apply the template.
The error i get in the console is
ERROR Error: An error has occurred while trying to retrieve data source property: ${c}
Is it a requirement to have the data source property to be in each and every node or is there a way for the template to check only to check for the node with has that particular data property.
Hello Mike,
You are right the app I've send was using earlier version of igniteui-angular2 which was distributing igniteui.angular2.js file, but with the latest packages we've renamed the file to index.js for consistency with other npm packages.
Changing this main: 'igniteui.angular2.js', to main: 'index.js', in system.config.js will allow running the app without errors.
I'm also attaching the modified sample.