khan4019 / tree-grid-directive

Need one or more maintainer for this! comment or email me if you are interested
http://khan4019.github.io/tree-grid-directive/test/treeGrid.html
347 stars 183 forks source link

Links inside the treegrid - href on the expanded rows #44

Closed arj-ary closed 8 years ago

arj-ary commented 9 years ago

Hello,

I have used tree-grid and i am very happy with the way it has turned out, however i am right now stuck at this point where i have show links on the rows, basically on one of the td vales. I am not able to do that since we can't provide html tags in the JSON data. Could you please advise on how i can do that ?

Thanks in advance,

74b0cf62686d117

thienhung1989 commented 9 years ago

just using:


{
field: 'Attachment',
cellTemplate: '<a href="{{ row.branch.data_attachment }}">Name File</a>'
}

Good Luck. P/S: I missed {{ }}

arj-ary commented 9 years ago

Hi @thienhung1989 ,

Thanks for the guidance. But how do i display the name of the file instead of " Name File "?. The name of the file is present in the form of JSON as show below. So i need to access the JSON field in cellTemplate. Please help ! Please see below -

var rawTreeData = [ { "DemographicId": 1, "ParentId": null, "Name": "Test Correspondence", "Attachment":"Doc1.pdf", "From": "Arjun Balaji", "To": "Rodney Clark", "Date": "04/07/2014", },

diosney commented 9 years ago

@arj-ary You can use the following code snippet:

cellTemplate: '<a href="{{ row.branch[col.field] }}">{{ row.branch['field_name'] }}</a>'

where field_name is the name of the field you want to access directly, say "Name".

arj-ary commented 9 years ago

Hi @diosney ,

Thank you, it worked. However i am not able to access give a value in the href field. The value is in the JSON format by field name "link". When i click on the link it navigates to a FileNotFound exception page. Please see below on how i am trying to access the link value, i am trying to click on the highlighted field.

var rawTreeData = [ { "DemographicId": 1, "ParentId": null, "Name": "Test Correspondence", "Attachment":"doc1.pdf", "link":"www.google.com", "From": "Arjun Balaji", "To": "Rodney Clark", "Date": "04/07/2014", },

f4e6f87427d468f

2070ef47bacd7d67

diosney commented 9 years ago

One other things you may want to try is to change href for ng-href and prepending http://to the link href attribute like this:

<a ng-href="http://{{ row.branch['link'] }}">test</>

If this not work for you, can you set up a jsfiddle or an example page for me to check it?

TrueDub commented 8 years ago

Is this still outstanding, or can I close it?

TrueDub commented 8 years ago

Closing due to lack of activity.