1

We are currently using ng-grid to display click-able flags in a grid, ie. cell 1 contain a green flag, cell 2 empty, cell 3 contains a red flag.

The flag represents the status.

To make the flag clickable, we have created a directive within each sell

<gridresultsummary data-ng-click="filterReportByOrderFromSummary()"  resultsummaryflag="{{row.entity[col.field]}}" />

the filterReportByOrderFromSummary() function at the moment, simply shows a static alert. What we are struggling to achieve, it a way to pass the column header into this function. we have tried many variations of

{{row.entity[col.field]}}
{{row.entity[col.header]}}
{{row.entity[col.headerValue]}}

however, still cant seem to capture it.

What is the syntax to retrieve the column header within a directive?

Simon
  • 1,412
  • 4
  • 20
  • 48

1 Answers1

1

You can try this :

{{col.displayName}}

It will get you access to the displayName from within the column.

Example here.

Goodzilla
  • 1,483
  • 11
  • 17
  • worked a treat! Brilliant!, is there an easy way to get the value from the first column? – Simon Jul 17 '14 at 13:14
  • You can use a workaround. Don't think there's a clean way. Something like this http://jsbin.com/nuhazi/4/watch?js,output – Goodzilla Jul 17 '14 at 13:34
  • apologies, i meant getting the actual cell value for the first column, not the header this time. – Simon Jul 17 '14 at 13:45
  • thats the one! thank you. is there a reason why row.entity[0] will not work? rather than hard coding the data type? – Simon Jul 17 '14 at 14:00
  • row.entity is not an array, just a document. Look at this example http://jsbin.com/huqekuhu/1/watch?js,output You can use workarounds, see this question http://stackoverflow.com/questions/1116708/getting-first-json-property – Goodzilla Jul 17 '14 at 14:04